CodeItBetter Programming Another VB Programming Blog

How to set the ComboBox DropDown List Height

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'Controls - How to set the ComboBox DropDown List Height

Option Explicit
 
'Add two ComboBoxes to your form.

Public 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) As Long
 
Function SetComboHeight(YourCombo As ComboBox, lDropDownHeight As Long)
    Dim iScaleMode As Integer
    If TypeOf YourCombo.Parent Is Frame Then Exit Function
    iScaleMode = YourCombo.Parent.ScaleMode
    YourCombo.Parent.ScaleMode = vbPixels
    MoveWindow YourCombo.hwnd, YourCombo.Left, YourCombo.Top, YourCombo.Width, lDropDownHeight, 1
    YourCombo.Parent.ScaleMode = iScaleMode
End Function
 
'How can I call this function:
Private Sub Main()
    SetComboHeight Combo1, 100
End Sub
Filed under: Controls Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.