Results 1 to 4 of 4

Thread: need help in creating line and extending it.

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    5

    need help in creating line and extending it.

    Private Sub picFloorplan_DragDrop(Source As Control, X As Single, Y As Single)


    Source.Move X, Y 'X - MouseX, Y - Mouse y

    picFloorplan.Line (X, Y)-(X + 4000, Y), vbRed 'Drawing the first line (right)
    picFloorplan.Line (X, Y)-(X - 4000, Y), vbRed 'Drawing the 2nd line (left)
    picFloorplan.Line (X, Y)-(X, Y - 4000), vbYellow 'Drawing the vertical line (Up)
    picFloorplan.Line (X, Y)-(X, Y + 4000), vbYellow 'Drawing the vertical line(down)
    picFloorplan.Line (X, Y)-(X + 1500, Y - 1000), vbBlue 'Drawing the top right
    picFloorplan.Line (X, Y)-(X + 1500, Y + 1000), vbBrown 'Drawing the bottom right
    picFloorplan.Line (X, Y)-(X - 1500, Y - 1000), vbBrown 'Drawing the top left
    picFloorplan.Line (X, Y)-(X - 1500, Y + 1000), vbBlue 'Drawing the bottom left


    End Sub

    This is my program

    I need help in "drawing the top right Line", how do i extend the line while using the same coordinate.

    Thank you.

  2. #2
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: need help in creating line and extending it.

    Welcome to the VB Forum
    To which point do you want to exent that line?
    Right now you draw it fro mthe mouse-position to the top rigth corner.
    If you want to draw them as horizontal lines, you better use.
    VB Code:
    1. picFloorplan.Line (X, Y-1000)-(X + 1500, Y - 1000), vbBlue 'Drawing the top right
    2. picFloorplan.Line (X, Y+1000)-(X + 1500, Y + 1000), vbBrown 'Drawing the bottom right
    3. picFloorplan.Line (X, Y-1000)-(X - 1500, Y - 1000), vbBrown 'Drawing the top left
    4. picFloorplan.Line (X, Y+1000)-(X - 1500, Y + 1000), vbBlue 'Drawing the bottom left
    could you explain in more detail what you want?
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    5

    Re: need help in creating line and extending it.

    i've solve the problem. thanks for the help anyway. but this there a way that i can extend these individual lines for it to reach the end of the corner of the picture box

  4. #4
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: need help in creating line and extending it.

    If I understood correctly, you want to draw lines from a Position within a Picturebox to the corners:
    Here is an example which draws lines from the mouseposition (X,Y) to each corner
    VB Code:
    1. picFloorplan.Line (X, Y)-(0, 0), vbBlue 'Drawing to the top left corner
    2. picFloorplan.Line (X, Y)-(picFloorplan.Width,0), vbBrown 'Drawing the top right corner
    3. picFloorplan.Line (X, Y)-(0, picFloorplan.Height), vbBrown 'Drawing the bottom left corner
    4. picFloorplan.Line (X, Y)-(picFloorplan.Width, picFloorplan.Height), vbBlue 'Drawing to the bottom right corner
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

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