Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Any way to draw diagram wide line (Read 3534 times)
Kyle Chen
Full Member
***
Offline


I Love MindFusion!

Posts: 104
Joined: Nov 29th, 2012
Any way to draw diagram wide line
Jul 30th, 2013 at 3:35pm
Print Post  
Hi,

Is there any way to create a line that will increase/decrease dynamically to diagram client width? even zoom in/out?

Thanks,

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Any way to draw diagram wide line
Reply #1 - Jul 30th, 2013 at 5:18pm
Print Post  
Hi,

You could call e.Graphics.DrawLine from DrawForeground or DrawBackground event handler. If the line position should depend on the currently visible part of the diagram, call view.ClientToDoc(view.ClientRectangle) to find it in document coordinates.

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


I Love MindFusion!

Posts: 104
Joined: Nov 29th, 2012
Re: Any way to draw diagram wide line
Reply #2 - Jul 31st, 2013 at 7:37pm
Print Post  
Hi Stoyan,

Because the line I'd like to draw is a kind of separator like the lane grid. it will behind some nodes and in front of some other nodes. so it would be better a link line or node.

I'm currently dynamically calculate the width using both diagram content and diagram client size. It works not as good as expected especially zoom out.

Thanks,

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Any way to draw diagram wide line
Reply #3 - Aug 1st, 2013 at 9:19am
Print Post  
Hi,

Then you could create an unconnected link for separator, using the Factory.CreateDiagramLink(point, point) overload, and place it at appropriate ZIndex. You can later modify the end points from scroll and zoom changed event handlers. The points' X coordinates should correspond to Left and Right values of the rectangle returned by view.ClientToDoc(view.ClientRectangle).

Alternatively, just make the link as wide as diagram.Bounds, then you should always see some part of it inside the viewport.

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


I Love MindFusion!

Posts: 104
Joined: Nov 29th, 2012
Re: Any way to draw diagram wide line
Reply #4 - Aug 1st, 2013 at 2:24pm
Print Post  
Thank you so much, Stoyan. I'm using ClientRectangle's left & right as lines' X now. It just works perfect!

Kyle
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint