![]() |
|
GTP.NET FAQ 10956Custom links Please note that this article
refers to the GTP.NET Jump to article- 2007-08-01 10:59:00 - Email plexityHide Question
I have created a custom link with the TimeItemLinkDrawStyle.User property but the OnTimeItemLink_SelectionChanged event doesn't raise and the UserDrawLinkEventArgs.G property is null in the OnUserDrawLink event when i select a custom link. How could i select a custom link? Can you help me?
Answer
The thing is that user drawn links can have any shape, so we need to find a way to describe that shape so that we can detect a selection. This is done by a two step process; selection region definition and drawing.
The selection region definition is done in the in the OnUserDrawLink event when the e.BoundingRegion is set. So, to have a selectable straight line link go like this:
void gantt1_OnUserDrawLink(Gantt aGantt, UserDrawLinkEventArgs e) { if (e.BoundingRegion!=null) { GraphicsPath gp = new GraphicsPath(); gp.AddLine(e.StartPoint, e.TargetPoint); gp.CloseFigure(); gp.Widen(new Pen(Color.Black,5)); e.BoundingRegion.Union(new Region(gp)); } else { e.G.DrawLine(Pens.Red, e.StartPoint, e.TargetPoint); } }
void gantt1_OnTimeItemLink_SelectionChanged(TimeItemLinks aLinks, TimeItemLinkArgs args) { if (args.TimeItemLink.TimeItemLinkDrawStyle==TimeItemLinkDrawStyle.User) MessageBox.Show("User drawn link selected"); }
|
"This is too GREAT. I must say you have strong support and really good programmers at your place. Your entire team is good. Just Fantastic! – 100%" |
| ? 1999-2006 PlexityHide.com Grastensvagen 24, S-163 45 Spanga Sweden E-mail: support@plexityhide.com |