Results 1 to 5 of 5

Thread: Graphics Editor

  1. #1

    Thread Starter
    Member
    Join Date
    May 2001
    Location
    India
    Posts
    35

    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?
    I believe... in myself

  2. #2
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    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!

  3. #3
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    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!

  4. #4

    Thread Starter
    Member
    Join Date
    May 2001
    Location
    India
    Posts
    35
    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?
    I believe... in myself

  5. #5
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Sorry, but VB doesn't draw dashed or dotted lines with a width greater than 1. Neither does Windows I think
    So if you really want that, you can write the lines routine yourself... but in my opinion it's not worth it for a tiny effect like that
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width