Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to draw text? (Read 1837 times)
lenix
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 31
Joined: Apr 6th, 2011
How to draw text?
Apr 6th, 2011 at 5:45am
Print Post  
Hello,
I'm currently evaluating Flowchart.NET and if everything turns out as expected we'll buy it soon.

I got a question though, how can I draw text on the chart? I want separate text ( not shape/node text .. etc).
Would appreciate a quick answer because some development is in progress right now.

Thanks in advance
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to draw text?
Reply #1 - Apr 6th, 2011 at 6:51am
Print Post  
Hi,

You can use a ShapeNode and set its Transparent property to true to display only the text, and AllowIncomingLinks and AllowOutgoingLinks to false to prevent connecting links to that node. This will let the user select and move the text node; if you want to disable that too, set Locked = true. If you need to draw only a little pre-defined text, you could also do that from the DrawBackground or DrawForeground event handlers.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to draw text?
Reply #2 - Apr 6th, 2011 at 7:01am
Print Post  
I've forgotten our new node type which I should promote - CompositeNode Smiley So you could also create a TextNode type that derives from CompositeNode and adds a single TextComponent to display only text. If you make it an EditComponent instead of TextComponent, the user will be able to directly enter text into the node.

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


I love YaBB 1G - SP1!

Posts: 31
Joined: Apr 6th, 2011
Re: How to draw text?
Reply #3 - Apr 6th, 2011 at 7:37am
Print Post  
I get the first method that you suggested.

But could you show me code example of the second method as I'm not totally sure how to implement it!

Thanks a lot Stoyo
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to draw text?
Reply #4 - Apr 6th, 2011 at 7:57am
Print Post  
Here's an example:

Code
Select All
public class TextNode : CompositeNode
{
	public TextNode(Diagram diagram, string label) : base(diagram)
	{
		BorderComponent border = new BorderComponent();
		border.Content = text;
		text.Text = label;
		Components.Add(border);
	}

	public string Label
	{
		get { return text.Text; }
		set { text.Text = value; }
	}

	TextComponent text = new TextComponent();
}

diagram.Nodes.Add(new TextNode(diagram, "my label")); 



You can see a more advanced one in the 'Demo' sample project - EmployeeNode.cs. And there are some tutorials under the "Tutorials / Using Components" section in the help file.

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