HScrollLabel peut remplacer avantageusement une Scroll barre, il renvoie sa valeur indicative, ne prend pas beaucoup de place, est personnalisable et precis.
L'icone affichee sur le control indique la marche a suivre.
On peut adapter le principe a une liste ou d'autre types de contrôles (voir l'exemple HScrollListe).
Source / Exemple :
'DANS UN MODULE OU DANS LA FEUILLE :
Public dz As Integer, ez As Integer, fz As Integer, gz As Integer, hz As Integer, iz As Integer, jz As Integer
Public Sub HScrollLab(Obj As Object, Button As Integer, X As Single, MinVal As Integer, MaxVal As Integer, Sensibility As Integer)
Obj.MousePointer = 99
Obj.MouseIcon = Command1.Picture
If Button = 0 Then
hz = 0
End If
If Button = 1 And hz = 0 Then
gz = X
fz = Obj.Caption
hz = 1
End If
If Button = 1 And hz = 1 Then
a = CInt((X - gz) / Sensibility)
b = fz + a
If b >= MinVal And b <= MaxVal Then
Obj.Caption = b
End If
End If
End Sub
Public Sub HScrollList(Obj As Object, Id As Integer, Button As Integer, X As Single, MinVal As Integer, MaxVal As Integer, Sensibility As Integer)
Obj.MousePointer = 99
Obj.MouseIcon = Command1.Picture
If Button = 0 Then
hz = 0
End If
If Button = 1 And hz = 0 Then
gz = X
fz = Obj.List(Id)
hz = 1
iz = Id 'Iz verrouille la variation sur l'index de liste(Id)
End If
If Button = 1 And hz = 1 Then
a = CInt((X - gz) / Sensibility)
b = fz + a
If b >= MinVal And b <= MaxVal Then
Obj.List(iz) = b
End If
Obj.Selected(iz) = True
End If
End Sub
'DANS UNE FEUILLE :
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Obj As Object, Button As Integer, X As Single, MinVal As Integer, MaxVal As Integer, Sensibility As Integer
Call HScrollLab(Label1, Button, X, 0, 127, 100)
End Sub
Private Sub List1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Obj As Object, Id As Integer, Button As Integer, X As Single, MinVal As Integer, MaxVal As Integer, Sensibility As Integer
Call HScrollList(List1, List1.ListIndex, Button, X, 0, 127, 100)
End Sub
Conclusion :
J'ai generaliser l'utilisation de ce control dans CORDE VIRTUELLE,
une application MIDI comportant d'innombrables parametres.
Les boutons tournant et autre curseurs ne sont tres ergonomiques.
www.cordevirtuelle.com
Did@cordevirtuelle.com
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.