I wrote a simple C # program using some graphical functions like drawElipse and drawLine in System.Drawing.Graphics. It works fine on one computer, but on my laptop it gives the exception of overflowing graphic functions. I need a program for working on a laptop for presentation in five hours, please help me.
Here are two functions that I get on error:
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);
}
source
share