- Dans un .Bas mettre :
- Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
-
- Dans votre code ou ailleur dans le projet :
- Public Sub AddBarreHoriz(ByRef CtrlLstBox As Object, ByVal FormParent As Object, ByVal Large As Integer)
- 'Ajoute une barre horizontale à un contrôle
- 'Indiquer à Large : 0 => Annule la barre horizontale
- ' >0 => Nb Caractères maxi de large
- Const NUL = &O0
- Const LB_SETHORIZONTALEXTENT = &H400 + 21
- Dim ListHwnd As Long, Scl As Integer, Réponse As Long
-
- On Error Resume Next
- Select Case Large
- Case Is > 0: Large = (Large / 15) * 110
- Case Else: Large = 1
- End Select
- Scl = FormParent.ScaleMode
- FormParent.ScaleMode = 3
- 'Récupère le focus du control (ListBox) & refresh
- 'CtrlLstBox.SetFocus
- ListHwnd = CtrlLstBox.hwnd
- 'Ajoute la barre horizontale
- Réponse = SendMessage(ListHwnd, LB_SETHORIZONTALEXTENT, Large, NUL)
- FormParent.ScaleMode = Scl
- End Sub
-
Dans un .Bas mettre :
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
Dans votre code ou ailleur dans le projet :
Public Sub AddBarreHoriz(ByRef CtrlLstBox As Object, ByVal FormParent As Object, ByVal Large As Integer)
'Ajoute une barre horizontale à un contrôle
'Indiquer à Large : 0 => Annule la barre horizontale
' >0 => Nb Caractères maxi de large
Const NUL = &O0
Const LB_SETHORIZONTALEXTENT = &H400 + 21
Dim ListHwnd As Long, Scl As Integer, Réponse As Long
On Error Resume Next
Select Case Large
Case Is > 0: Large = (Large / 15) * 110
Case Else: Large = 1
End Select
Scl = FormParent.ScaleMode
FormParent.ScaleMode = 3
'Récupère le focus du control (ListBox) & refresh
'CtrlLstBox.SetFocus
ListHwnd = CtrlLstBox.hwnd
'Ajoute la barre horizontale
Réponse = SendMessage(ListHwnd, LB_SETHORIZONTALEXTENT, Large, NUL)
FormParent.ScaleMode = Scl
End Sub