I wrote a simple C# program using some graphic functions as drawElipse and drawLine at System.Drawing.Graphics. It works perfectly on one computer, but at my laptop it gives overflow exception at the graphics functions. I need the program to work on the laptop for a presentation after five hours, please help me.
Here are the two functions I get the error in:
private void drawDot(int n)
{
Graphics gfx = CreateGraphics();
int mapx = (int)verts[n].mapx;
int mapy = (int)verts[n].mapy;
Pen myPen = new Pen(Color.DarkOliveGreen, 5);
if (mapx > 2 && mapy > 2)
{
Rectangle rect = new Rectangle((int)mapy - 2, (int)mapx - 2, 10, 10);
gfx.DrawEllipse(myPen, rect);
}
}
private void drawLine(int n, int k)
{
int mapnx = (int)verts[n].mapx;
int mapny = (int)verts[n].mapy;
int mapkx = (int)verts[k].mapx;
int mapky = (int)verts[k].mapy;
Graphics gfx = CreateGraphics();
Pen myPen = new Pen(Color.DarkOliveGreen, 3);
gfx.DrawLine(myPen, mapny, mapnx, mapky, mapkx);
}