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.
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:
picFloorplan.Line (X, Y-1000)-(X + 1500, Y - 1000), vbBlue 'Drawing the top right
picFloorplan.Line (X, Y+1000)-(X + 1500, Y + 1000), vbBrown 'Drawing the bottom right
picFloorplan.Line (X, Y-1000)-(X - 1500, Y - 1000), vbBrown 'Drawing the top left
picFloorplan.Line (X, Y+1000)-(X - 1500, Y + 1000), vbBlue 'Drawing the bottom left
could you explain in more detail what you want?
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
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:
picFloorplan.Line (X, Y)-(0, 0), vbBlue 'Drawing to the top left corner
picFloorplan.Line (X, Y)-(picFloorplan.Width,0), vbBrown 'Drawing the top right corner
picFloorplan.Line (X, Y)-(0, picFloorplan.Height), vbBrown 'Drawing the bottom left corner
picFloorplan.Line (X, Y)-(picFloorplan.Width, picFloorplan.Height), vbBlue 'Drawing to the bottom right corner