Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic New question is coming (Read 1737 times)
CanadaProgrammer
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 113
Joined: Jun 30th, 2011
New question is coming
Jul 23rd, 2012 at 11:47pm
Print Post  
I did not come here for a long time.

I want to allow use change the text of DiagramLink. My code is below:

link.Text = "aaaa"; // link is a MyLink type object

there classes are here
class MyLink : MyMyLink
{
// nothing here
}

class MyMyLink : DiagramLink
{
// nothing here
}

link can be shown on diagram but "aaaa" can not be shown. Give a hand, thanks.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: New question is coming
Reply #1 - Jul 24th, 2012 at 6:32am
Print Post  
Code
Select All
ShapeNode n1 = diagram.Factory.CreateShapeNode(0, 0, 10, 10);
ShapeNode n2 = diagram.Factory.CreateShapeNode(60, 0, 10, 10);
MyLink link = new MyLink(diagram, n1, n2);
diagram.Links.Add(link);
link.Text = "test";

public class MyMyLink : DiagramLink
{
	public MyMyLink(Diagram d, DiagramNode n1, DiagramNode n2) : base(d, n1, n2)
	{
	}
}

public class MyLink : MyMyLink
{
	public MyLink(Diagram d, DiagramNode n1, DiagramNode n2) : base(d, n1, n2)
	{
	}
} 



shows the text in my test app. The "nothing here" comment cannot be true since you must create at least a constructor to pass arguments to the base DiagramLink constructor. If you are overriding the Draw method, make sure you are also calling base.Draw or otherwise you will have to render the text yourself by calling Graphics.DrawString(). Also make sure TextColor is not set to Color.Empty or Color.Transparent.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
CanadaProgrammer
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 113
Joined: Jun 30th, 2011
Re: New question is coming
Reply #2 - Jul 24th, 2012 at 4:27pm
Print Post  
Thanks, I found the problem.

One more question, diagram.items.Add(link) and diagram.Links.Add(link) are same?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: New question is coming
Reply #3 - Jul 25th, 2012 at 6:44am
Print Post  
Yes, they are equivalent.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint