Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

draw line on picturebox

Status
Not open for further replies.

Kavius

Programmer
Apr 11, 2002
322
CA
I know I have done this before, but for some reason I cannot get it to work.

When I run it and click on the picture box, nothing happens. I have stepped through it and its running...

It has to be something stupidly small... Help?
Code:
Private Sub Picture1_Click()
  Picture.Line (X1, Y1)-(X2, Y2)
End Sub


 
kavius,

This example works for me:

Private Sub Picture1_Click()
Picture1.Line (0, 0)-(200, 200)
End Sub

Check your scale, units and X,Y values: they could be too small and so on.

But first of all, replace Picture with Picture1.

Vladk
 
kavius,

You probably need MouseDown. Try this:

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static sngX As Single
Static sngY As Single

Picture1.Line (sngX, sngY)-(X, Y)

sngX = X
sngY = Y

End Sub
 
doh... just deleted my reply.

I don't know why it makes a difference but if I 'cls' first, no problem....

weird.

Thanks though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top