Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Creating ShapeNode programmatically (Read 3310 times)
Hunter
Full Member
***
Offline



Posts: 194
Location: Sevastopol
Joined: Dec 1st, 2009
Creating ShapeNode programmatically
Dec 1st, 2009 at 12:57pm
Print Post  
Hello. I downloaded the trial version of the MindFusion.Diagramming for WPF. I tried to create the node such as:
Code
Select All
    int nInpNum = int.Parse(dlg.textBoxInps.Text);
    int nOutNum = int.Parse(dlg.textBoxOuts.Text);
    ShapeNode node = m_Diagram.Factory.CreateShapeNode(40, 40, 5, 80, Shapes.Rectangle);
    AnchorPointCollection anchorPnts = new AnchorPointCollection();
    double nOffset = nInpNum > 0 ? 100 / (nInpNum + 1) : 50;
    for (int i = 0; i < nInpNum; ++i)
    {
  AnchorPoint point = new AnchorPoint(0,
nOffset * (i + 1), true, false, MarkStyle.Rectangle);
  anchorPnts.Add(point);
    }
    nOffset = nOutNum > 0 ? 100 / (nOutNum + 1) : 50;
    for (int i = 0; i < nOutNum; ++i)
    {
  AnchorPoint point = new AnchorPoint(100,
nOffset * (i + 1), false, true, MarkStyle.Rectangle);
  anchorPnts.Add(point);
    }
    node.AnchorPattern = new AnchorPattern(anchorPnts);
    node.EnabledHandles = AdjustmentHandles.ResizeTopCenter |
  AdjustmentHandles.ResizeBottomCenter | AdjustmentHandles.Move;
    node.HandlesStyle = HandlesStyle.EasyMove;
    node.Brush = Brushes.Black;
 


Anchor points creates successful. Node creates also successful but it isn't resize or move. What's wrong?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Creating ShapeNode programmatically
Reply #1 - Dec 1st, 2009 at 1:30pm
Print Post  
Hi,

Do you see the stop cursor shown while moving or resizing, or you can't start any modification at all? It seems the modification code doesn't allow nodes to be set smaller than 2 mm in any dimension, even if you are resizing in the other dimension, so if the node starts 5 points wide, this might cause the problem. You might create a bit wider node to allow modifications, or otherwise we'd have to add some property that defines the minimum size allowed for nodes to let you make it <= 5 points.

Stoyan
  
Back to top
 
IP Logged
 
Hunter
Full Member
***
Offline



Posts: 194
Location: Sevastopol
Joined: Dec 1st, 2009
Re: Creating ShapeNode programmatically
Reply #2 - Dec 1st, 2009 at 1:45pm
Print Post  
Stoyo wrote on Dec 1st, 2009 at 1:30pm:
Hi,

Do you see the stop cursor shown while moving or resizing, or you can't start any modification at all? It seems the modification code doesn't allow nodes to be set smaller than 2 mm in any dimension, even if you are resizing in the other dimension, so if the node starts 5 points wide, this might cause the problem. You might create a bit wider node to allow modifications, or otherwise we'd have to add some property that defines the minimum size allowed for nodes to let you make it <= 5 points.

Stoyan

Thank you very much! I created the wide 8 points and all works as I need. If the wide less or equal to 7 then it works with problems. All modifications starts successful but not finished. Stop cursor is really present in this case. I think that 8 points is possible wide for my task. But it will be good if it is possible to create the wide less than 8 points for visualize the bus on the diagram.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Creating ShapeNode programmatically
Reply #3 - Dec 1st, 2009 at 3:33pm
Print Post  
Ok, we'll try to make this minimum size a property later this week.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Creating ShapeNode programmatically
Reply #4 - Dec 16th, 2009 at 3:52pm
Print Post  
Hi,

This version adds MinimumNodeSize property to Diagram:
https://mindfusion.eu/_beta/wpfdiag23.zip

Set it to "4,4" or smaller value, and you will be able to modify the 5-point wide node.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Hunter
Full Member
***
Offline



Posts: 194
Location: Sevastopol
Joined: Dec 1st, 2009
Re: Creating ShapeNode programmatically
Reply #5 - Dec 17th, 2009 at 1:04pm
Print Post  
Thank you very much!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint