|
Установить высоту выпадающего окна ComboBox'а к количеству имеющихся строк |
|
|
Запустите проект, нажмите на стрелку элемента ComboBox, затем сделайте клик левой клавишей мыши на любом пустом месте формы, затем снова щелкните на элементе ComboBox... 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 ResizeCbo(cbo As ComboBox)
Counter = cbo.ListCount
cboLeft = cbo.Left / Screen.TwipsPerPixelX
cboTop = cbo.Top / Screen.TwipsPerPixelY
cboWidth = cbo.Width / Screen.TwipsPerPixelX
cboHeight = cbo.Height / Screen.TwipsPerPixelX * Counter
MoveWindow cbo.hwnd, cboLeft, cboTop, cboWidth, cboHeight, 1
End Sub
Private Sub Form_Click()
Call ResizeCbo(Combo1)
End Sub
Private Sub Form_Load()
Combo1.AddItem "1"
Combo1.AddItem "2"
Combo1.AddItem "3"
Combo1.AddItem "4"
Combo1.AddItem "5"
Combo1.AddItem "6"
Combo1.AddItem "7"
Combo1.AddItem "8"
Combo1.AddItem "9"
Combo1.AddItem "10"
Combo1.AddItem "11"
Combo1.AddItem "12"
Combo1.AddItem "13"
Combo1.AddItem "14"
End Sub
|
|
|
|
|
|
|