Groups | Blog | Home
all groups > dotnet drawing api > may 2005 >

dotnet drawing api : drawing lines between objects.


WAkthar
5/12/2005 12:00:00 AM
I have a picture control to which I've added icons in different parts of the
control. I also have modeless dialogs which appear when a user clicks on
these icons. I need to be able to draw a line from the icon to the dialog,
and when the user moves the dialog, redraw the line so it is always
connected between the icon and the dialog. I may also have many icons and
many dialogs for these icons.

Are there any examples or can someone show me how to implement this
functionality please?



Thanks in advance!!


Bob Powell [MVP]
5/12/2005 12:00:00 AM
You can use ControlPaint.DrawReversibleLine. It takes screen coordiantes so
you just need to convert the coords of the icon within the pictureboc to
screen coords using PointToScreen and do something similar with the dialod
box and draw a line between the two points.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





[quoted text, click to view]

AddThis Social Bookmark Button