En vrac et à revoir, car chez moi, beaucoup d'aléat encore.
Pour + d'info, cherche SendMessage sur MSDN
J'avais 1 VScrollBar (ScrollTexte) + 2 RTB (txtGauche et txtDroite)
' Déclarations
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _
ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Const SB_LineUp = &H0
Const SB_LineDown = &H1
Const SB_PageUp = &H2
Const SB_PageDown = &H3
Const SB_Home = -1
Const SB_End = &H7
Const EM_Scroll = &HB5
' La Sub de VScrollBar qui me sert
Private Sub ScrollTexte_Change()
Static OldPos As Long
' Pour pouvoir synchroniser les 2 listes, il faut gérer en commun les
' déplacements du curseur = ScrollTexte
With ScrollTexte
Select Case (.Value - OldPos)
Case Is = .SmallChange ' Petit déplacement en bas
Call SendMessage(txtGauche.hwnd, EM_Scroll, SB_LineDown, 0)
Call SendMessage(txtDroite.hwnd, EM_Scroll, SB_LineDown, 0)
Case Is = .SmallChange * (-1) ' Petit déplacement en haut
Call SendMessage(txtGauche.hwnd, EM_Scroll, SB_LineUp, 0)
Call SendMessage(txtDroite.hwnd, EM_Scroll, SB_LineUp, 0)
Case Is = .LargeChange ' Gros déplacement en bas
Call SendMessage(txtGauche.hwnd, EM_Scroll, SB_PageDown, 0)
Call SendMessage(txtDroite.hwnd, EM_Scroll, SB_PageDown, 0)
Case Is = .LargeChange * (-1) ' Gros déplacement en haut
Call SendMessage(txtGauche.hwnd, EM_Scroll, SB_PageUp, 0)
Call SendMessage(txtDroite.hwnd, EM_Scroll, SB_PageUp, 0)
End Select
' Mémorise position actuelle pour futur test
OldPos = .Value
End With
End Sub
Vala
Jack, MVP VB
NB : Je ne répondrai pas aux messages privés
Le savoir est la seule matière qui s'accroit quand on la partage. (Socrate)