1,451
社区成员
发帖
与我相关
我的任务
分享
'设置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 setComboHeight(oComboBox As ComboBox, lNewHeight As Long)
Dim oldscalemode As Integer
Dim lngLeft&, lngTop&, lngWidth&
lngLeft = oComboBox.Left
lngTop = oComboBox.Top
lngWidth = oComboBox.Width
If TypeOf oComboBox.Parent Is Frame Then Exit Sub
oldscalemode = oComboBox.Parent.ScaleMode
oComboBox.Parent.ScaleMode = vbPixels
MoveWindow oComboBox.hwnd, lngLeft \ 15, lngTop \ 15, lngWidth \ 15, lNewHeight, 1
oComboBox.Parent.ScaleMode = oldscalemode
End Sub