1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| Private Sub UserForm_Activate()
ListBox1.List = Evaluate("row(1:15)")
End Sub
Private Sub ListBox1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
ListBox1.Enabled = False
Image1.Move ListBox1.Left, ListBox1.Top, ListBox1.Width, ListBox1.Height
End Sub
Private Sub Image1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Static q&
Static q2&
With Image1
If Button = 1 Then
If q = -1 Then
q = Int(Y / (.Height / ListBox1.ListCount)): If q > ListBox1.ListCount - 1 Then q = ListBox1.ListCount - 1
q2 = q
Else
q2 = Int(Y / (.Height / ListBox1.ListCount)): If q2 > ListBox1.ListCount - 1 Then q2 = ListBox1.ListCount - 1
End If
Else
q = -1
q2 = -1
End If
If Button = 1 Then
If q < q2 Then a = q: b = q2 Else a = q2: b = q
For i = a To b
ListBox1.Selected(i) = True
Next
Me.Caption = q & " " & q2
End If
Me.Caption = q & " " & q2
End With
End Sub
Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Image1.Move ListBox1.Left + ListBox1.Width, ListBox1.Top, 10, 10
ListBox1.Enabled = True
End Sub |
Partager