Click to See Complete Forum and Search --> : Line Control with Click Event - Please help!
davecooper
Oct 19th, 2000, 07:06 PM
I need a line control with a click event in the worst way! My application works great except that I need to allow the user to be able to erase any number of lines. Each line will be a member of a control array.
I recall reading that this is possible but can't seem to track the reference down.
Thanks
Hi Dave.
I didn't read the thread, but I think I can help you.
Instead of using a click event on a line control (which does not have a click event, of course), draw the lines on your form (or pic box) and use math calculations to verify if the cursor is over a line or not on the click event of your form (or pic box).
line formula:
y = m * x + b where m is the inclination (delta_y/delta_x) and b is the "y" value when x = 0.
Once you have calculated m and b (which is easy enough when you have the X1, Y1, X2 and Y2 points of a line command), you should be able to verify if the cursor is over a line and then erase that line from the form and from your array as well.
I hope that's good enough...
Good luck!
davecooper
Oct 20th, 2000, 12:03 AM
Thanks for trying. This is a geoboard application for kids. I have an 11 X 11 grid with lots and lots of differently colored line segments. I need for the user to be able to erase any given segment. I'm confident that the only way to handle this problem is to use line controls with click events. Right now I'm drawing the lines but can replace them with line controls once I can get them to respond to the user.
This problem can't be solved by checking the color of the segment either.
Thanks again.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.