Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic System.OutOfMemoryException after diagram resizing (Read 4218 times)
shalex
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 16
Joined: Jan 14th, 2010
System.OutOfMemoryException after diagram resizing
Jan 14th, 2010 at 6:17am
Print Post  
I have three diagram views on a form, a single zoomer to control zooming in these views. Sometimes I get strange black areas after placing node via drag'n'drop operation. May be these black areas was the reason of OutOfMemoryException which I've received after zooming. One of the views disappered, instead there was a white window with crossed red lines.

System.OutOfMemoryException: Недостаточн&#1
086; памяти.
в System.Drawing.Graphics.CheckErrorStatus(Int32 status)
в System.Drawing.Graphics.DrawPath(Pen pen, GraphicsPath path)
в MindFusion.Drawing.GdiGraphics.DrawPath(Pen pen, GraphicsPath path)
в MindFusion.Diagramming.ShapeNode.xc79d59e9288101bd(IGraphics x41347a961b838962, RectangleF xa6236fc5cd405c4e, Boolean x2f9dabff87b2168b, Brush xb45de92d01a0ec1f, Pen x9c79b5ad7b769b12, RenderOptions xdfde339da46db651)
в MindFusion.Diagramming.ShapeNode.DrawShadow(IGraphics graphics, RenderOptions options)
в MindFusion.Diagramming.Diagram.x826b585edd6a93e2(IGraphics x41347a961b838962, RectangleF xa6236fc5cd405c4e, Boolean x979174172ae18db3)
в MindFusion.Diagramming.Diagram.Draw(IGraphics graphics, RenderOptions options, RectangleF clipRect, Boolean noModifiedItems)
в MindFusion.Diagramming.WinForms.DiagramView.x45babdc9db40342f(IGraphics x41347a961b838962, RectangleF xd1cff1e8f8666dbe, Boolean x8de543c74cdd4f6e)
в MindFusion.Diagramming.WinForms.DiagramView.OnPaint(PaintEventArgs pe)
в System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
в System.Windows.Forms.Control.WmPaint(Message& m)
в System.Windows.Forms.Control.WndProc(Message& m)
в System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
в System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
в System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: System.OutOfMemoryException after diagram resi
Reply #1 - Jan 14th, 2010 at 6:43am
Print Post  
Hi,

Could you copy the call stack here? We often get out-of-memory exceptions from GDI+ when drawing with a dashed pen while antialiasing is enabled; are you using any dashed pens?

Stoyan
  
Back to top
 
IP Logged
 
shalex
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 16
Joined: Jan 14th, 2010
Re: System.OutOfMemoryException after diagram resi
Reply #2 - Jan 14th, 2010 at 7:08am
Print Post  
Yes, I use a dash pen for links. Something like:
[code]
Shape.Pen.DashStyle = DashStyle.Dash;
Shape.Pen.DashPattern = new float[] { 10, 10 };
[/code]
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: System.OutOfMemoryException after diagram resi
Reply #3 - Jan 14th, 2010 at 8:30am
Print Post  
We suspect the error is caused by a combination of antialiasing and graphics.PageUnit different than pixel when drawing with dashed pens. Try disabling DiagramView.SmoothingMode or set MeasureUnit to Pixel to see if it helps.

If you prefer using both antialiaing and millimeters, you might try drawing links like this:

Code
Select All
link.CustomDraw = Full;
void diagram_DrawLink(...)
{
	try {
		e.Link.CustomDraw = None;
		e.Link.Draw(e.Graphics);
		e.Link.CustomDraw = Full;
	}
	catch (Exception) {}
} 



This is how the control draws the dashed selection rectangles, and we haven't noticed any adverse effects from catching and ignoring the exception.
  
Back to top
 
IP Logged
 
shalex
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 16
Joined: Jan 14th, 2010
Re: System.OutOfMemoryException after diagram resi
Reply #4 - Jan 16th, 2010 at 2:23pm
Print Post  
Thank you, I'll try.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint