sonoboss
Messages postés178Date d'inscriptionlundi 17 juin 2002StatutMembreDernière intervention 2 octobre 2007
-
9 janv. 2003 à 11:51
cs_MyC
Messages postés94Date d'inscriptionlundi 23 septembre 2002StatutMembreDernière intervention22 avril 2003
-
26 mars 2003 à 09:20
Voila mon pb je doit faire un prog en un minimum d'espace et donc pour optimiser je regroupe au max...
Je me retrouve donc avec plusieur contenu de taille différentes ds mon combobox et le combo est trop petit...
Ya til un moyen pour adapter dynamiqement la taille d'un combo par rapport à son contenu???
Merci d'avance!
Le jour où la merde vaudra de l'or, les pauvres naîtons sans trou du cul!
cs_MyC
Messages postés94Date d'inscriptionlundi 23 septembre 2002StatutMembreDernière intervention22 avril 2003 9 janv. 2003 à 13:53
Salut sonoboss !
Voilà la solution :
Option Explicit
Private Declare Function MoveWindow& Lib "user32" (ByVal hwnd As Long, _
ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, _
ByVal nHeight As Long, ByVal bRepaint As Long)
Private Sub Combo1_DropDown()
SetDropdownHeight Combo1, ScaleHeight
End Sub
' Adjust height of combobox dropdown part; call in response to DropDown event
Private Sub SetDropdownHeight(cbo As ComboBox, ByVal max_extent As Integer)
' max_extent is the absolute maximum clientY value that the dropdown may extend to
' case 1: nItems <= 8 : do nothing - vb standard behaviour
' case 2: Items will fit in defined max area : resize to fit
' case 3: Items will not fit : resize to defined max height
If cbo.ListCount > 8 Then
Dim max_fit As Integer ' maximum number of items that will fit in maximum extent
Dim item_ht As Integer ' Calculated height of an item in the dropdown