The ComboBox control does not allow the height to be dynamically resized if the Style of the combobox is 0 or 2. Is there any way around this using APIs?
Printable View
The ComboBox control does not allow the height to be dynamically resized if the Style of the combobox is 0 or 2. Is there any way around this using APIs?
Try this
VB Code:
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) As Long Public Sub SetDropHeight(cbo As ComboBox, lngHeight As Long) Dim intScaleMode As Integer intScaleMode = cbo.Parent.ScaleMode cbo.Parent.ScaleMode = vbPixels MoveWindow cbo.hwnd, cbo.Left, cbo.Top, cbo.Width, lngHeight, 1 cbo.Parent.ScaleMode = intScaleMode End Sub Private Sub Command1_Click() SetDropHeight Combo1, 500 End Sub
Thanks, that looks like it only(?) alters the height of the drop-down and that isn't what I am looking for. When the user resizes my form, I dynamically alter the height and width of all the controls on the form. While I can resize the width of the combobox, the height can not be because the combobox's Height property is read-only and I'm hoping there is an API that will allow me to alter it.
Sorry, completely miss-understood. Yeah that alters the height of the drop-down window.
Although if it can alter the drop-down, it should be able to alter the size of any window, including a combo
I'll give it a try and see what happens. BTW, glad I could help with your post count :)