Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Change shape of Node (Read 3699 times)
Tima
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 25
Joined: Nov 10th, 2010
Change shape of Node
Nov 20th, 2010 at 11:07am
Print Post  
Can we change shape of node at the time of creation
land color like Size?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Change shape of Node
Reply #1 - Nov 22nd, 2010 at 7:14am
Print Post  
You can do that from the initializeNode or nodeCreated event handler. The former is raised before the user sees the nodes, the latter once they release the mouse button after drawing. Changing the size from initializeNode will probably won't work, but it should be ok to set it from nodeCreated.

Code
Select All
diagram.addDiagramListener(new DiagramAdapter() {
	@Override
	public void initializeNode(NodeEvent e)
	{
		if (e.getNode() instanceof ShapeNode)
		{
			ShapeNode node = (ShapeNode)e.getNode();
			node.setShape(Shape.fromId("Process"));
			node.setBrush(new SolidBrush(Color.gray));
		}
	}
} 



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


I love YaBB 1G - SP1!

Posts: 25
Joined: Nov 10th, 2010
Re: Change shape of Node
Reply #2 - Nov 22nd, 2010 at 7:25am
Print Post  
sry sir but i want when i create obj of shapenode that time can i deside shape of that node
if i hav three or four types of node can i give diff shape to all?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Change shape of Node
Reply #3 - Nov 22nd, 2010 at 7:33am
Print Post  
You can add several toolbar buttons displaying the shapes and call Diagram.setDefaultShape() from their click handlers. That will let you select what kind of shape to draw interactively with the mouse. You can also add the shapes to a ShapeListBox control and then drag-and-drop them to the diagram canvas.

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


I love YaBB 1G - SP1!

Posts: 25
Joined: Nov 10th, 2010
Re: Change shape of Node
Reply #4 - Nov 22nd, 2010 at 8:56am
Print Post  
Thanks
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint