2个回答
展开全部
你是不是嫌下拉框的长度不够使的?要是这样一来的话可以使用如下代码:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
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
'本函数是用于设置combox下拉列表框的长度的.
Private Sub SetComboHeight(oComboBox As ComboBox, lNewHeight As Long)
Dim oldscalemode As Integer
'注释: This procedure does not work with frames: you
'注释: cannot set the ScaleMode to vbPixels, because
'注释: the frame does not have a ScaleMode Property.
'注释: To get round this, you could set the parent control
'注释: to be the form while you run this procedure.
If TypeOf oComboBox.Parent Is Frame Then Exit Sub
'注释: Change the ScaleMode on the parent to Pixels.
oldscalemode = oComboBox.Parent.ScaleMode
oComboBox.Parent.ScaleMode = vbPixels
'注释: Resize the combo box window.
MoveWindow oComboBox.hwnd, oComboBox.Left, oComboBox.Top, oComboBox.Width, lNewHeight, 1
'注释: Replace the old ScaleMode
oComboBox.Parent.ScaleMode = oldscalemode
End Sub
在窗体的LOAD中可添加Call SetComboHeight(Combo1, 270) '设置combo的下拉长度.
来调用.
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
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
'本函数是用于设置combox下拉列表框的长度的.
Private Sub SetComboHeight(oComboBox As ComboBox, lNewHeight As Long)
Dim oldscalemode As Integer
'注释: This procedure does not work with frames: you
'注释: cannot set the ScaleMode to vbPixels, because
'注释: the frame does not have a ScaleMode Property.
'注释: To get round this, you could set the parent control
'注释: to be the form while you run this procedure.
If TypeOf oComboBox.Parent Is Frame Then Exit Sub
'注释: Change the ScaleMode on the parent to Pixels.
oldscalemode = oComboBox.Parent.ScaleMode
oComboBox.Parent.ScaleMode = vbPixels
'注释: Resize the combo box window.
MoveWindow oComboBox.hwnd, oComboBox.Left, oComboBox.Top, oComboBox.Width, lNewHeight, 1
'注释: Replace the old ScaleMode
oComboBox.Parent.ScaleMode = oldscalemode
End Sub
在窗体的LOAD中可添加Call SetComboHeight(Combo1, 270) '设置combo的下拉长度.
来调用.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询