|
-
May 31st, 2002, 11:24 PM
#1
Thread Starter
Member
Graphics Editor
I am trying to create a simple graphics editor where a user can draw lines with the mouse in a picture box already containing a background. The idea is to allow the user to create a network over a map.
I am using the VB line object to create the lines the user draws.
But the problem is to edit the lines drawn by the user. As the Line object does not have any Click or MouseMove method, I am unable to allow users to edit them. I want the users to click on the endpoint of the line and move it to a new location to stretch or reduce the length.
Can someone please help?
-
Jun 1st, 2002, 04:56 AM
#2
Frenzied Member
well there is different ways to do things like this. One easy way would be:
do it all in a picture box. You are going to take its mouse move event
in the mousemove event first check if a button is pressed if so (and if it's the first time it is pressed down, meaning it has not been held down...you check this over a global boolean) you put a for each loop for all the lines and check if one of their endpoints is under the mouse. You need to add some tolerance here since it is kind of hard to hit a line that accurate. Also to make things easier set the pictureboxes scalemode to Pixel.
now for the editing... early you had to check if the mouse is down, but has not been held, there you decide which line to take. Now if you already selected a line and the user still holds the button down you just the set selected point according to the x and y value you are given by the mousemove event.
I hope this helps, if you need more info post again.
Sanity is a full time job
Puh das war harter Stoff!
-
Jun 1st, 2002, 05:04 AM
#3
Frenzied Member
well I talked about different ways to do it earlier and than I only put one way so here we go.
Since it would be nice to give the user a clue where to click for a line you could move small buttons to the end of each line (maybe if the user enabled some editing mode) using the "for ... each" again. Now you would have a click event and all, so you would just put in the moving as described above.
Sanity is a full time job
Puh das war harter Stoff!
-
Jun 2nd, 2002, 12:36 PM
#4
Thread Starter
Member
hi
thanx for ur suggestions with i was able to do it. thanx again.
however i still have a problem. i'm trying to draw the lines in different styles, like dashed, continuous etc. but when the style is dashed, the line width remains 1 and hence appears thin. is there a workout for it?
-
Jun 3rd, 2002, 05:08 PM
#5
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|