Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to draw a shape. (Read 2073 times)
feege
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Dec 10th, 2007
How to draw a shape.
Dec 10th, 2007 at 11:18pm
Print Post  
Hi,

I am currently developing a web application which will need to use NetDiagram. Currently the flowchart is built with Visio, but now want it done using NetDiagram.

In visio we have developed custom shapes, which I need to develop in NetDiagram.

The shape is a rectangle divided into 3 sections horizontally. I need to put different text in each section retrieved from a database. Also need to color code each section depending on the data retrieved (ie: Critical = "Red"  Not Critical = "Green"

Can this be done with NetDiagram.

Rgds

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to draw a shape.
Reply #1 - Dec 11th, 2007 at 6:19am
Print Post  
Hi,

You can do that using a group of boxes:

Code
Select All
Node CreateShape(RectangleF bounds)
{
	Box shape = fc.CreateBox(bounds.X, bounds.Y, bounds.Width, bounds.Height);
	shape.EnabledHandles = Handles.All & ~Handles.Rotate;
	shape.HandlesStyle = HandlesStyle.DashFrame;

	Box section1 = fc.CreateBox(bounds.X, bounds.Y, bounds.Width, bounds.Height / 3);
	section1.AttachTo(shape, 0, 0, 100, 100f / 3);
	section1.FillColor = Color.Red;
	section1.Text = "section 1";
	section1.IgnoreLayout = true;
	section1.Locked = true;

	Box section2 = fc.CreateBox(bounds.X, section1.BoundingRect.Bottom, bounds.Width, bounds.Height / 3);
	section2.AttachTo(shape, 0, 100f / 3, 100, 200f / 3);
	section2.FillColor = Color.Green;
	section2.Text = "section 2";
	section2.IgnoreLayout = true;
	section2.Locked = true;

	Box section3 = fc.CreateBox(bounds.X, section2.BoundingRect.Bottom, bounds.Width, bounds.Height / 3);
	section3.AttachTo(shape, 0, 2 * 100f / 3, 100, 100f);
	section3.FillColor = Color.Yellow;
	section3.Text = "section 3";
	section3.IgnoreLayout = true;
	section3.Locked = true;

	return shape;
}
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint