Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Different result with Drawing in picturebox on different PC.

$
0
0

When i run the app on my PC, it works like expected and the drawn numberline is from -10 to +10.  While on other PC's number line is only in range from -10 to +5. I have no idea what causes this, looks like it's not cause of resolution.

My PC ( Works good -10 to +10 ):

App running on my pc

Another PC ( problem with numberline -10 to only 5)

problematic numberline

Here's code snippet that draws the actual numberline:

public void DrawNumberLine(int x2)
        {
            // numberLine
            Graphics A;
            A = Graphics.FromImage(DrawArea);
            A.Clear(TransparencyKey);
            //A.Clear(Color.Black);
            Pen mypen1 = new Pen(Brushes.Green);
            mypen1.Width = 1;
            A.DrawLine(mypen1, start, v_mid, 500, v_mid);

            // number locators
            int x1 = 0;
            int currentpixel = start;
            int ppu = 480 / x2;
            Int32 realnumber = (x2 / 2) * -1;
            while (x1 < x2 + 1)
            {
                mypen1.Width = 2;


                //if (currentpixel <= 0) { currentpixel = 1; }
                A.DrawLine(mypen1, currentpixel, v_mid - 5, currentpixel, v_mid + 15);
                A.DrawString(Convert.ToString(realnumber), this.Font, Brushes.White, currentpixel - 5, v_mid + 20);
                x1 += 1;
                currentpixel += ppu;
                realnumber += 1;
            }

        }

So how could this possibly happen?

Thanks in advance for helping me to resolve this problem!


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>