自己用 TextBox, CommandBox 和 ListBox(Style = 1)控件“组装”一个:Option ExplicitPrivate Sub Command1_Click() Dim strTmp As String, i As Integer If List1.Visible Then For i = 0 To List1.ListCount - 1 If List1.Selected(i) Then strTmp = strTmp & IIf(strTmp > "", ",", "") & List1.List(i) Next i
If InStr(strTmp, ",") Then Text1 = "(" & strTmp & ")" Else Text1 = strTmp End If Text1.SetFocus List1.Visible = False Command1.Caption = 6 Else List1.Visible = True List1.SetFocus Command1.Caption = 5 End If End SubPrivate Sub Form_Load() List1.AddItem 1 List1.AddItem 2 List1.Top = Text1.Top + Text1.Height + 10 List1.Visible = False Command1.Height = Text1.Height - 60 Command1.Width = Command1.Height Command1.Top = Text1.Top + 30 Command1.Left = Text1.Left + Text1.Width - Command1.Width - 30 Command1.Caption = "6" Command1.Font = "Webdings" Command1.Font.Size = 9 Text1 = "" End Sub
Dim strTmp As String, i As Integer If List1.Visible Then
For i = 0 To List1.ListCount - 1
If List1.Selected(i) Then strTmp = strTmp & IIf(strTmp > "", ",", "") & List1.List(i)
Next i
If InStr(strTmp, ",") Then
Text1 = "(" & strTmp & ")"
Else
Text1 = strTmp
End If
Text1.SetFocus
List1.Visible = False
Command1.Caption = 6
Else
List1.Visible = True
List1.SetFocus
Command1.Caption = 5
End If
End SubPrivate Sub Form_Load()
List1.AddItem 1
List1.AddItem 2
List1.Top = Text1.Top + Text1.Height + 10
List1.Visible = False
Command1.Height = Text1.Height - 60
Command1.Width = Command1.Height
Command1.Top = Text1.Top + 30
Command1.Left = Text1.Left + Text1.Width - Command1.Width - 30
Command1.Caption = "6"
Command1.Font = "Webdings"
Command1.Font.Size = 9
Text1 = ""
End Sub