dHeather
Active member
- Joined
- Jun 18, 2012
- Messages
- 27
- Programming Experience
- Beginner
Hello,
I am currently working on a form on which the user can draw a continuos line made up of lines and arc segments. (See example) I am drawing to a bitmap using DrawLine and DrawArc. I have got this working fine. What I am struggling with is how the user can edit a line once drawn. I would like them to be able to click on a previously drawn line (red in the example) and its attributes come up (length, Radius, Degrees etc. These I have stored in arrays) which the user can update. I will then run a refresh routine (written and working) to redraw the line from the data in the arrays. As I am only ever working with a continuos line this is very simple to do.
As stated I am currently storing the line lengths, radius, degrees and the opening X,Y co-ordinates of my line in arrays so that I can redraw it. I can identify when I have clicked on a line simply by checking the pixel colour of my click, but I can't find a way of knowing which segment of line I am in (third on the example) to be able to reference my array and tweak the attributes.
I have considered adding a hot zone to each line segment, a few pixels wide, in a different colour which the user would click to edit, but this seems a little primative. I have also looked at storing every point my line runs through and comparing my click against that, but I'm worried that I'll end up creating a monster trying to record every X,Y point I pass through.
Is there another way?
Thanks for taking the time to look at this. Your help would be much appreciated.
Example:

I am currently working on a form on which the user can draw a continuos line made up of lines and arc segments. (See example) I am drawing to a bitmap using DrawLine and DrawArc. I have got this working fine. What I am struggling with is how the user can edit a line once drawn. I would like them to be able to click on a previously drawn line (red in the example) and its attributes come up (length, Radius, Degrees etc. These I have stored in arrays) which the user can update. I will then run a refresh routine (written and working) to redraw the line from the data in the arrays. As I am only ever working with a continuos line this is very simple to do.
As stated I am currently storing the line lengths, radius, degrees and the opening X,Y co-ordinates of my line in arrays so that I can redraw it. I can identify when I have clicked on a line simply by checking the pixel colour of my click, but I can't find a way of knowing which segment of line I am in (third on the example) to be able to reference my array and tweak the attributes.
I have considered adding a hot zone to each line segment, a few pixels wide, in a different colour which the user would click to edit, but this seems a little primative. I have also looked at storing every point my line runs through and comparing my click against that, but I'm worried that I'll end up creating a monster trying to record every X,Y point I pass through.
Is there another way?
Thanks for taking the time to look at this. Your help would be much appreciated.
Example:

Last edited: