Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Customizing Shape Node (Read 3693 times)
bobmazelin
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Dec 27th, 2006
Customizing Shape Node
Apr 28th, 2009 at 10:23am
Print Post  
Hi,all:
    I want to create a Shape Node by Customizing the Appearance. Can you give me some example code?Thanks!
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Customizing Shape Node
Reply #1 - Apr 28th, 2009 at 11:19am
Print Post  
Hi,

You can customize the nodes shape, fill, outline and text:

ShapeNode node = d.Factory.CreateShapeNode(...);
node.Shape = Shapes.Decision;
node.Brush = new SolidColorBrush(Colors.Orange);
Pen p = new Pen();
p.Brush = new SolidColorBrush(Colors.Blue);
p.Thickness = 3;
node.Pen = p;
node.Text = "test";
node.FontSize = 15;

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
bobmazelin
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Dec 27th, 2006
Re: Customizing Shape Node
Reply #2 - Apr 28th, 2009 at 11:28am
Print Post  
Thanks for your reply!
But I want to draw a Customizing Node, so I can not use the Predefined. Then, how to do this?
thank you!
  
Back to top
 
IP Logged
 
bobmazelin
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Dec 27th, 2006
Re: Customizing Shape Node
Reply #3 - Apr 28th, 2009 at 11:31am
Print Post  
I create it like this:
ElementTemplate[] templateArray = new ElementTemplate[4];
templateArray[0] = new LineTemplate(0.0, 0.0, 100, 0.0);
templateArray[1] = new LineTemplate(100, 0.0, 100, 100);
templateArray[2] = new LineTemplate(100, 100, 0.0, 100);
templateArray[3] = new LineTemplate(0.0, 100, 0.0, 0.0);
MindFusion.Diagramming.Silverlight.Shape s = new MindFusion.Diagramming.Silverlight.Shape(templateArray, FillRule.Nonzero);
ShapeNode shapeNode = this.MyDiagram.Factory.CreateShapeNode(new Point(0,0), new Size(50, 50));
shapeNode.Shape = s;
shapeNode.Brush = Brushes.Black;
shapeNode.Selected = true;
but it can not be worked.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Customizing Shape Node
Reply #4 - Apr 28th, 2009 at 12:36pm
Print Post  
Hi,

Seems shapes don't work correctly when you don't assign some ID to them. Use the Shape constructor that takes a string id argument and it should work fine.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
bobmazelin
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Dec 27th, 2006
Re: Customizing Shape Node
Reply #5 - Apr 28th, 2009 at 12:48pm
Print Post  
yes, it's ok now!
thanks for your help.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint