Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1512

Move the control array together

$
0
0
Code:

Option Explicit
Dim xx As Single, yy As Single

Private Sub Picture1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    DoMouseDown Button, X, Y
End Sub
Private Sub Picture1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    DoMove "Picture1", Button, X, Y
End Sub

 Private Sub Picture2_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    DoMouseDown Button, X, Y
End Sub
Private Sub Picture2_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    DoMove "Picture2", Button, X, Y
End Sub

Sub DoMouseDown(Button As Integer, X As Single, Y As Single)
    If Button = 1 Then
        xx = X
        yy = Y
    End If
End Sub
Sub DoMove(GroupName As String, Button As Integer, X As Single, Y As Single)
If Button = 1 Then
    Dim ControlArr As Object, Pic As Object
    Select Case GroupName
    Case "Picture1"
        Set ControlArr = Picture1
    Case "Picture2"
        Set ControlArr = Picture2
    End Select
    For Each Pic In ControlArr
    Pic.Left = Pic.Left + X - xx
    Pic.Top = Pic.Top + Y - yy
    Next
End If

End Sub

can use for like this:
How to Render multiple images into one AlphaImage control-VBForums
https://www.vbforums.com/showthread....aImage-control
Attached Files

Viewing all articles
Browse latest Browse all 1512

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>