Link to home
Start Free TrialLog in
Avatar of ioustinos_sarris
ioustinos_sarrisFlag for Greece

asked on

Make line clickable VB.NET

Hi there, i am drawing some lines on a System.Drawing.Graphics object.

for example
gMyGraphics.DrawLine(pMyPen, 0 + lineStartMargin, lineYpos, lineWidth + lineStartMargin, lineYpos)

Open in new window


I want that line to be clickable and run a function when its clicked.
Any ideas?
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

You have two options

1) Keep the points at which the line exists and when mouse is clicked within the container of the line, get the coordinates and if the coordinates match with any of those of the line then execute the function you want.

2) Use a control such as label instead of drawing a line. This will obviously work only if you want to draw a straight horizontal line.
ASKER CERTIFIED SOLUTION
Avatar of Brad Brett
Brad Brett
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial