Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleChange the height of a ComboBox's dropdown area
KeywordsComboBox, ComboBox height
CategoriesControls
 
By Arden C. Harrell.

Use the MoveWindow API function.

See also Change the width of a ComboBox's dropdown area.

 
' Resize a ComboBox's dropdown display area.
Public Sub SizeCombo(frm As Form, cbo As ComboBox)
Dim cbo_left As Integer
Dim cbo_top As Integer
Dim cbo_width As Integer
Dim cbo_height As Integer
Dim old_scale_mode As Integer

    ' Change the Scale Mode on the form to Pixels.
    old_scale_mode = frm.ScaleMode
    frm.ScaleMode = vbPixels

    ' Save the ComboBox's Left, Top, and Width values.
    cbo_left = cbo.Left
    cbo_top = cbo.Top
    cbo_width = cbo.Width

    ' Calculate the new height of the combo box.
    cbo_height = frm.ScaleHeight - cbo.Top - 5
    frm.ScaleMode = old_scale_mode

    ' Resize the combo box window.
    MoveWindow cbo.hwnd, cbo_left, cbo_top, _
        cbo_width, cbo_height, 1
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated