Graphics.DrawPath(Pen pen, GraphicsPath path) problem (arithmetic / overflow exception)... (in 2.0)

L

Lloyd Dupont

I'm using 2.0 beta2
I have this method which, occasionally throw an OverflowException with the
message:
An arithmetic, casting, or conversion operation in a checked context results
in a overflow

I created everything with code looking like:

override OnPaint(PaintEventArgs e)
{
e.Graphics.Transform = new Matrix(1, 0, 0, 1, -2411, -724);

GraphicsPath path = new GraphicsPath();
path.StartFigure();
path.AddLine(new PointF(2824, 793), new PointF(2839, 792));
path.AddLine(new PointF(2839, 792), new PointF(2838, 799));
path.CloseFigure();

Pen pen = new Pen(Color.FromArgb(79, 0, 0, 255), 3.0f);

e.Graphics.DrawPath(pen, path); // <= overflow exception here
}

what could it be?
my value (like 2824) appear correctly in the debugger....

I even wrap all my code in an
unchecked
{
}
block but it didn't help... :(

any idea?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top