求教高手 :关于改变ComboBox控件下拉列表长度的Bug
代码:Option Explicit
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 SizeCombo(CBobj As ComboBox, ByVal newHeight As Long)
Dim cLeft As Long
Dim cTops As Long
Dim cWidths As Long
Dim oldMode As Long
oldMode = CBobj.Parent.ScaleMode
CBobj.Parent.ScaleMode = vbPixels
cLeft = CBobj.Left
cTops = CBobj.Top
cWidths = CBobj.Width
CBobj.Parent.ScaleMode = oldMode
MoveWindow CBobj.hwnd, cLeft, cTops, cWidths, newHeight, 1
End Sub
程序应用在主界面上没有问题,如图:
但一旦置入其它的控件中,如:SSTab、Frame、PictureBox等控件中,执行程序后,就会不能在原位置显示,如图:
已经想过很多办法,都没法解决,请教高手不吝赐教,先行感谢!