我有一个组合框,它是从SQL-SERVER填充的,带有一个名字列表。我要做的是,让用户点击下拉列表并显示所有名称而不向下滚动。
答案 0 :(得分:1)
假设组合字体与表单
相同Option Explicit
Private Declare Function MoveWindow Lib "user32" _
(ByVal hWnd As Long, ByVal x As Long, ByVal y As Long, _
ByVal cx As Long, ByVal cy As Long, ByVal updt As Long) As Long
Private Sub Form_Load()
Dim I As Long
Me.ScaleMode = vbPixels
With Combo1
MoveWindow .hWnd, .Left, .Top, .Width, .Height + (Me.TextHeight("W") * 11), 0 'why 11 and not 10? i realy don't know right now
End With
For I = 1 To 20
Combo1.AddItem "Item " & I
Next I
End Sub