Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic error drawing boxes near bound of flowchar (Read 6090 times)
Amanda Hillier
Guest


error drawing boxes near bound of flowchar
Jul 14th, 2006 at 5:34pm
Print Post  
I am using Flowchart.net version 4.0.3.30382 in a user control.

Whenever I try a box near or out of the bounds of the flowchart I get the follow error that bubbles up to the main application:

Parameter not valid. 

This is an unhandled condition.  The full abend info that I get is:

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

************** Exception Text **************
System.ArgumentException: Parameter is not valid.
   at System.Drawing.Drawing2D.GraphicsPath.AddArc(Single x, Single y, Single width, Single height, Single startAngle, Single sweepAngle)
   at MindFusion.FlowChartX.Utilities.getRoundRect(Single x, Single y, Single width, Single height, Single r)
   at MindFusion.FlowChartX.Box.Draw(Graphics g, Boolean shadow)
   at MindFusion.FlowChartX.FlowChart.OnMouseMove(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseMove(Message& m)
   at System.Windows.Forms.Control.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)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e
089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll

----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/Sy
stem.Drawing.dll
----------------------------------------
System.Web.Services
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Web.Services/2.0.0.0__b03f5f7f11d50a
3a/System.Web.Services.dll
----------------------------------------
System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50
a3a/System.Configuration.dll
----------------------------------------
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.0.0
    CodeBase: file:///C:/vssMerchSystemsSOA/Projects/AIM/Source%20Code/AIMShell/AIM.Shell/AIMS
hell/bin/Debug/Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.DLL
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System
.Xml.dll
----------------------------------------
gbu58wee
    Assembly Version: 1.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll

----------------------------------------
rxawbz6p
    Assembly Version: 1.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll

----------------------------------------
bpryqzo4
    Assembly Version: 1.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll

----------------------------------------
FlowChart.NET
    Assembly Version: 4.0.3.30382
    Win32 Version: 4.0.3.30382
    CodeBase: file:///C:/vssMerchSystemsSOA/Projects/AIM/Source%20Code/AIMShell/AIM.Shell/AIMS
hell/bin/Debug/FlowChart.NET.DLL
----------------------------------------
6sif9eq2
    Assembly Version: 1.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll

----------------------------------------

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: error drawing boxes near bound of flowchar
Reply #1 - Jul 14th, 2006 at 6:53pm
Print Post  
I cannot reproduce that. What is the value of the RoundRectFactor property? Could you email me a saved diagram with a box in it so I test that with the same settings as yours?

Thank you,
Stoyan
  
Back to top
 
IP Logged
 
Amanda Hillier
Guest


Re: error drawing boxes near bound of flowchar
Reply #2 - Jul 17th, 2006 at 2:05pm
Print Post  
I created a mini app to reproduce the error which is:

( I will place the code and properties in the next reply)

System.ArgumentException was unhandled
  Message="Parameter is not valid."
  Source="System.Drawing"
  StackTrace:
      at System.Drawing.Drawing2D.GraphicsPath.AddArc(Single x, Single y, Single width, Single height, Single startAngle, Single sweepAngle)
      at MindFusion.FlowChartX.Utilities.getRoundRect(Single x, Single y, Single width, Single height, Single r)
      at MindFusion.FlowChartX.Box.Draw(Graphics g, Boolean shadow)
      at MindFusion.FlowChartX.FlowChart.xbb6158772b674179(Graphics x4b101060f4767186, ChartObject xa59bff7708de3a18, Boolean x79ee3f6bdf75f984)
      at MindFusion.FlowChartX.FlowChart.OnMouseMove(MouseEventArgs e)
      at System.Windows.Forms.Control.WmMouseMove(Message& m)
      at System.Windows.Forms.Control.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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
      at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
      at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNat
iveMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
      at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
      at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
      at System.Windows.Forms.Application.Run(Form mainForm)
      at testproject.Program.Main() in C:\Projects\testproject\testproject\Program.cs:line 17
      at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
      at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
      at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
      at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Threading.ThreadHelper.ThreadStart()


TO GET THE ERROR:
You must reset the flowchart using the button and then draw boxes continueously right at the border of the flowchart.  It takes some patience to recreate the error with this app but my user's have created it quite easily using my app.
  
Back to top
 
IP Logged
 
Amanda Hillier
Guest


Re: error drawing boxes near bound of flowchar
Reply #3 - Jul 17th, 2006 at 2:16pm
Print Post  
Set up a project with the following:

panel
flowchart
button

           // flowChart1            
           this.flowChart1.ArrowHead = MindFusion.FlowChartX.ArrowHead.Triangle;
           this.flowChart1.ArrowHeadSize = 4F;
           this.flowChart1.ArrowsSnapToBorders = true;
           this.flowChart1.ArrowTextStyle = MindFusion.FlowChartX.ArrowTextStyle.OverLongestSegment;
           this.flowChart1.BoxesExpandable = true;
           this.flowChart1.DefaultControlType = typeof(System.Windows.Forms.Button);
           this.flowChart1.DocExtents = ((System.Drawing.RectangleF)(resources.GetObject("flowChart1.DocExtents")));
           this.flowChart1.Dock = System.Windows.Forms.DockStyle.Fill;
           this.flowChart1.InplaceEditFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
           this.flowChart1.Location = new System.Drawing.Point(0, 0);
           this.flowChart1.Name = "flowChart1";
           this.flowChart1.RestrObjsToDoc = MindFusion.FlowChartX.RestrictToDoc.NoRestriction;
           this.flowChart1.Size = new System.Drawing.Size(583, 425);
           this.flowChart1.TabIndex = 0;
           this.flowChart1.BoxCreated += new MindFusion.FlowChartX.BoxEvent(this.flowChart1_BoxCreated);

           // panel1
           this.panel1.Controls.Add(this.flowChart1);
           this.panel1.Location = new System.Drawing.Point(12, 27);
           this.panel1.Name = "panel1";
           this.panel1.Size = new System.Drawing.Size(583, 425);
           this.panel1.TabIndex = 1;

           // button1
           this.button1.Location = new System.Drawing.Point(442, 458);
           this.button1.Name = "button1";
           this.button1.Size = new System.Drawing.Size(72, 30);
           this.button1.TabIndex = 2;
           this.button1.Text = "button1";
           this.button1.UseVisualStyleBackColor = true;
           this.button1.Click += new System.EventHandler(this.button1_Click);

           // Form1
           this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
           this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
           this.ClientSize = new System.Drawing.Size(607, 488);
           this.Controls.Add(this.button1);
           this.Controls.Add(this.panel1);
           this.Name = "Form1";
           this.Text = "Form1";
           this.panel1.ResumeLayout(false);
           this.ResumeLayout(false);
       }
  
Back to top
 
IP Logged
 
Amanda Hillier
Guest


Re: error drawing boxes near bound of flowchar
Reply #4 - Jul 17th, 2006 at 2:22pm
Print Post  
[code]

namespace testproject
{
    public partial class Form1 : Form
    {
       private Box _rootBox = null;
       private Group _rootGroup = null;
       TreeLayout _treeLayout = null;

       public Form1()
       {
           InitializeComponent();
           InitTree();            
       }

       private void InitTree()
       {  Point PT = new Point(0, 0);
           PT.Y = 50;
           PT.X = 5;
           _rootBox = this.flowChart1.CreateBox(PT.X, PT.Y, 25, 15);
           _rootBox.Tag = Guid.NewGuid().ToString ();
           FormatBox(_rootBox.Tag.ToString());
           _rootGroup = this.flowChart1.CreateGroup(_rootBox);
           _rootGroup.Tag = _rootBox.Tag;
           AddChild(_rootBox);}

       private void AddChild(Box ParentBox)
       {  try
           {Group _parentGroup = this.flowChart1.FindGroup(ParentBox.Tag);
               if (_parentGroup == null)
                   throw new Exception("PARENT_GROUP_NOTFOUND");
                              
               Box _childBox = this.flowChart1.CreateBox(0, 0, 25, 15);
               _parentGroup.AttachToCorner(_childBox, 0);
               _childBox.Tag = Guid.NewGuid().ToString ();
               FormatBox(_childBox.Tag.ToString());
               FormatBox(ParentBox.Tag.ToString());
               Arrow _link = this.flowChart1.CreateArrow(ParentBox, _childBox);
               _link.Text = "";
               _link.Tag = _childBox.Tag;
               Group _group = this.flowChart1.CreateGroup(_childBox);
               _group.Tag = _childBox.Tag;
                   }
               }
               Rearrange();
               SaveNode(_childBox.Tag.ToString(), _childBox.BoundingRect.Location.X, _childBox.BoundingRect.Location.Y);}

           catch (Exception ex)
           {
               this.Cursor = Cursors.Arrow;
               MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
           }
       }
      
       private void Rearrange()
       {
           try{
               if (_treeLayout == null)
               {
                   _treeLayout = new TreeLayout(_rootBox,
                       TreeLayoutType.Centered,
                       false,
                       TreeLayoutArrowType.Rounded,
                       TreeLayoutDirection.RightToLeft,
                       10, 5, true, 10, 10);
               }

               _treeLayout.Arrange(this.flowChart1);
               this.flowChart1.FitDocToObjects(10);
           }
           catch (Exception ex)
           {
               this.Cursor = Cursors.Arrow;
               MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
           }
       }       
       private void flowChart1_BoxCreated(object sender, MindFusion.FlowChartX.BoxEventArgs e)
       {
           try{               
               e.Box.Tag = Guid.NewGuid().ToString (); 
               FormatBox(e.Box.Tag.ToString());
               Group _group = this.flowChart1.CreateGroup(e.Box);
               _group.Tag = e.Box.Tag;
               e.Box.Selected = true;
               SaveNode(e.Box.Tag.ToString(), e.Box.BoundingRect.Location.X, e.Box.BoundingRect.Location.Y);               
           }
           catch (Exception ex)
           {  this.Cursor = Cursors.Arrow;
               MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
           }
       }

       private void FormatBox(String NodeTag)
       {
           try{
               Box _box = this.flowChart1.FindBox(NodeTag);
               if (_box != null)
               {   _box.FillColor = Color.FromArgb(255, 255, 255);
                   _box.Resize(35, 15);
                   _box.TextColor = Color.Black;
                   _box.AnchorPattern = AnchorPattern.LeftInRightOut;
                   _box.Text = "test box";
               }
           }
           catch (Exception ex)
           {
               this.Cursor = Cursors.Arrow;
               MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
           }
       }
      
       private void SaveNode(String s, float x, float y)
       {
           string _s = s;
           float _x = x;
           float _y = y;
       }

       private void button1_Click(object sender, EventArgs e)
       {
           this.Cursor = Cursors.WaitCursor;
           this.flowChart1.ClearAll();
           this.flowChart1.ZoomFactor = 100;
           InitTree();
           this.Cursor = Cursors.Arrow;
       }
    }
   
}
[/code]
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: error drawing boxes near bound of flowchar
Reply #5 - Jul 18th, 2006 at 5:11am
Print Post  
I've single-handedly drawn several hundred boxes near the borders but the exception did not happen.

Anyway AddArc isn't documented to throw any exceptions, so our only guess is that it might do some division by the coordinates passed as parameters, and if they are close to 0 an overflow error could occur. Try this version of the dll:

https://mindfusion.org/_temp/fcnetarcs.zip

It adds try/catch around the AddArc calls and just draws a rectangular shape if an exception is caught.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint