|
-
Jan 20th, 2000, 05:48 AM
#1
Thread Starter
Registered User
Hey all of you out there...
How do I drag a picture box so when i am dragging, i see the picture box's picture ?
------------------
------
God:
------
Oh...those israeli programmers..!
-
Sep 4th, 2001, 11:48 PM
#2
Junior Member
Dragging while showing Picture Box contents
The following code will work:
Dim oldX As integer
Dim oldY As Integer
Private Sub PiecePic_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
oldX = X
oldY = Y
End If
End Sub
Private Sub PiecePic_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
PiecePic(Index).Top = PiecePic(Index).Top + (Y - oldY)
PiecePic(Index).Left = PiecePic(Index).Left + (X - oldX)
End If
End Sub
-
Sep 5th, 2001, 05:53 AM
#3
It is probably better to store OldX and OldY as static variables inside of the MouseMove event. Keeps global variables down.
Z.
-
Sep 5th, 2001, 06:12 AM
#4
Frenzied Member
And how would you cope with the oldX and oldY vars then if they are inside the sub since they don't keep their value (or share it) with the other sub.
Looking at the that code thats the only simple way to do it =)
-
Sep 5th, 2001, 07:51 AM
#5
I dont know of any reason why you would want to use those values outside of that Sub. But, if you really wanted to share them with everyone, you could:
Code:
Type POINTAPI
X as Long
Y as Long
End Type
And store the values in that, so you dont take up a global variable name.
Z.
-
Sep 5th, 2001, 07:54 AM
#6
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
|