Click here to Skip to main content
15,904,024 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I used GDI++ (DrawLine() function with PointF parameters), I compiled it (by VS2008 on Win7 system), when I run it on Win7 system it run well, I run it on WinXP - it generates an error:


See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.OutOfMemoryException: Out of memory.
   at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
   at System.Drawing.Graphics.DrawLine(Pen pen, Single x1, Single y1, Single x2, Single y2)
   at System.Drawing.Graphics.DrawLine(Pen pen, PointF pt1, PointF pt2)
   at pTPTCoi.uDothi.uDothi_Paint(Object sender, PaintEventArgs e)
   at System.Windows.Forms.Control.OnPaint(PaintEventArgs e)
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.UserControl.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


How i can solve this error? Thanks.
Posted
Comments
Kenneth Haugland 20-Sep-12 23:19pm    
Your out of memory, so we need to see the code were the error occured.
Andrewpeter 20-Sep-12 23:28pm    
Thank you very much, my code is so long, with message above I dont know error location in my code (what code line?...), can you show me the code line number which is error? Thanks.
Andrewpeter 20-Sep-12 23:33pm    
When I see the end of that message:


************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitdebugging="true">


When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.


Where do i have to put
<configuration>
<system.windows.forms jitdebugging="true">

in my code?

Thanks.
Kenneth Haugland 20-Sep-12 23:39pm    
I dont know that, so cant help you there. But I would step through the debugger to see were the error occured. You should at least be able to find that out by "brute force" ;)
Andrewpeter 21-Sep-12 4:08am    
Thank you. I have found that error. At block:

float[] dashValues = { 5, 2, 5 };
Pen penLuoi = new Pen(Color.Olive, 1);
penLuoi.DashPattern = dashValues;

I removed dashValues and instead it to:

Pen penLuoi = new Pen(Color.Olive, 1.0F);
penLuoi.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot;

It's very good. I solved.

1 solution

Thank you. I have found that error. At block:

C#
float[] dashValues = { 5, 2, 5 };
Pen penLuoi = new Pen(Color.Olive, 1);
penLuoi.DashPattern = dashValues;


I removed dashValues and instead it to:

C#
Pen penLuoi = new Pen(Color.Olive, 1.0F);
penLuoi.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot;


It's very good. I solved. Thanks all.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900