Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Need Custom ShapedNode (Read 3048 times)
Bala
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 156
Joined: Apr 21st, 2009
Need Custom ShapedNode
May 15th, 2009 at 4:23am
Print Post  
Hi Stoyan,
I want to draw some custom shape node.I have sent images of them to "support@mindfusion.eu". Please send the snippet of them as soon as possible.

Thanks,
Bala
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Need Custom ShapedNode
Reply #1 - May 15th, 2009 at 8:57am
Print Post  
Instead of drawing the shapes in MSPaint and emailing them to us, you could draw them in the ShapeDesigner tool and copy the generated code.
  
Back to top
 
IP Logged
 
Bala
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 156
Joined: Apr 21st, 2009
Re: Need Custom ShapedNode
Reply #2 - May 15th, 2009 at 12:05pm
Print Post  
Hi Stoyo,

I have tried a lot to make desired balloon shape but unable to make it Sad .Following is the code generated by the designer.

Code
Select All
ShapeNode shapeNode = new MindFusion.Diagramming.Wpf.Shape(
	 new ElementTemplate[]
	 {
		new LineTemplate(0, 0, 100, 0),
		new LineTemplate(100, 0, 100, 100),
		new LineTemplate(100, 100, 0, 100),
		new LineTemplate(0, 100, 0, 0)
	 },
	 new ElementTemplate[]
	 {
		new BezierTemplate(10, 26, 20, -3, 62, -3, 78, 12),
		new BezierTemplate(60, 67, 70, 56, 103, 43, 76, 11),
		new BezierTemplate(10, 26, 6, 54, 31, 60, 36, 67),
		new BezierTemplate(35, 66, 41, 70, 46, 75, 49, 85),
		new BezierTemplate(61, 65, 55, 72, 51, 77, 49, 85)
	 },
 null, FillRule.EvenOdd, "Balloon"); 



In this, I am getting a SquareShape outside the balloon which I don’t want. Apart from that I also want a Button (expandable + and - button which will display menu when expanded).You can check it from the mail, about its complete description. Also the balloon is something different with the requesting one. Its design needs some more modification.

Please help to sort out my problem.

Thanks & Regards,
Bala
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Need Custom ShapedNode
Reply #3 - May 15th, 2009 at 2:02pm
Print Post  
The square shape comes from the first argument, which defines the shape outline. I suppose you have drawn your balloon using decoration elements. Try copying the second array argument over the first one, and passing null as second argument.

If you need that 'menu' to stay open and follow the node, implement it using a TableNode attached to the balloon. Set ExpandButtonAction to RaiseEvents and handle the ExpandButtonClicked event to show or hide the table.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Need Custom ShapedNode
Reply #4 - May 15th, 2009 at 2:21pm
Print Post  
Code
Select All
new Shape(new ElementTemplate[]
	{
		new BezierTemplate(10, 35, 10, 25, 25, 5, 50, 5),
		new BezierTemplate(50, 5, 75, 5, 90, 25, 90, 35),
		new BezierTemplate(90, 35, 95, 60, 55, 75, 50, 100),
		new BezierTemplate(50, 100, 45, 75, 5, 60, 10, 35)
	},
	null,
	new Rect(0, 100, 100, 50),
	FillRule.EvenOdd, "Balloon");
 

  
Back to top
 
IP Logged
 
Bala
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 156
Joined: Apr 21st, 2009
Re: Need Custom ShapedNode
Reply #5 - May 18th, 2009 at 3:00pm
Print Post  
Hi Stoyan,

Thanks for the suggestion.
I have tried to make TableNode but it is not even visible to me.Also I am not able to get ExpandButtonAction of this tableNode. Following is the code which I have used for my sample.

Code
Select All
ShapeNode node = new ShapeNode(diagram);
		node = diagram.Factory.CreateShapeNode(new Point(150, 525), new Size(45, 45));

		DiagramNode diagramNode = (DiagramNode)node;
		TableNode tableNode = new TableNode(diagram);
		tableNode.AttachTo(diagramNode, AttachToNode.MiddleRight);
		tableNode.Expandable = true;
		tableNode.Visible = true;
		diagram.Nodes.Add(node); 



Please let me know about my mistake.

Thanks,
Bala
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Need Custom ShapedNode
Reply #6 - May 19th, 2009 at 7:32am
Print Post  
You are adding the ShapeNode twice, and the TableNode not at all. Either call Factory.CreateTableNode instead of using the constructor, or replace diagram.Nodes.Add(node) with diagram.Nodes.Add(tableNode).
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint