秦国以后是什么国家:VB编程,如何实行点击组合框下拉键例出十多行的选项

来源:百度文库 编辑:神马品牌网 时间:2024/05/05 07:53:45
老师请指教.

在属性中设置啊,有个list,看到了吗??
通过它就可以设置的!!

你是不是嫌下拉框的长度不够使的?要是这样一来的话可以使用如下代码:
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的下拉长度.
来调用.