|
|
-
Tips เกี่ยวกับ ComboBox
' Resize a ComboBox's dropdown display area.
- 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
|
.
|