Results 1 to 5 of 5

Thread: Dynamically Size ComboBox

  1. #1

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Try this
    VB Code:
    1. 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
    2.  
    3. Public Sub SetDropHeight(cbo As ComboBox, lngHeight As Long)
    4.  
    5. Dim intScaleMode As Integer
    6.    
    7. intScaleMode = cbo.Parent.ScaleMode
    8. cbo.Parent.ScaleMode = vbPixels
    9. MoveWindow cbo.hwnd, cbo.Left, cbo.Top, cbo.Width, lngHeight, 1
    10. cbo.Parent.ScaleMode = intScaleMode
    11.    
    12. End Sub
    13.  
    14. Private Sub Command1_Click()
    15.  
    16. SetDropHeight Combo1, 500
    17.  
    18. End Sub

  3. #3

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    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.

  4. #4
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    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

  5. #5

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width