Yos Nugroho via .NET 247
2005-03-15 06:27:07 UTC
Hi,
Recently I stummbled on an unexpected, weird behavior of Graphics.DrawLine method.
This is an example code :
Bitmap bmp = new Bitmap(100, 100);
Graphics g = Graphics.FromImage(bmp);
Point p1 = new Point(int.MaxValue, 0);
Point p2 = new Point(0, 0);
g.DrawLine(Pens.Black, p1, p2);
g.Dispose();
bmp.Dispose();
If I run the code, it will throw a System.OverflowException.
It seems that if the line is too long, the exception occurs.
I look into MSDN docs and found nothing about this.
Anybody can help please?
Thanks.
--------------------------------
Yos Nugroho
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>SV4ll44HbUalRXgHP7/RHA==</Id>
Recently I stummbled on an unexpected, weird behavior of Graphics.DrawLine method.
This is an example code :
Bitmap bmp = new Bitmap(100, 100);
Graphics g = Graphics.FromImage(bmp);
Point p1 = new Point(int.MaxValue, 0);
Point p2 = new Point(0, 0);
g.DrawLine(Pens.Black, p1, p2);
g.Dispose();
bmp.Dispose();
If I run the code, it will throw a System.OverflowException.
It seems that if the line is too long, the exception occurs.
I look into MSDN docs and found nothing about this.
Anybody can help please?
Thanks.
--------------------------------
Yos Nugroho
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>SV4ll44HbUalRXgHP7/RHA==</Id>