Private Sub mnuCopy_Click ()
Clipboard.Clear
If TypeOf Screen.ActiveControl Is TextBox Then
Clipboard.SetText Screen.ActiveControl.SelText
ElseIf TypeOf Screen.ActiveControl Is ComboBox Then
Clipboard.SetText Screen.ActiveControl.Text
ElseIf TypeOf Screen.ActiveControl Is PictureBox _
Then
Clipboard.SetData Screen.ActiveControl.Picture
ElseIf TypeOf Screen.ActiveControl Is ListBox Then
Clipboard.SetText Screen.ActiveControl.Text
Else
'对其它控件没有意义的动作。
End If
End Sub
Private Sub mnuCut_Click ()
'首先要做的与复制相同。
mnuCopy_Click
'现在清除活动控件的内容。
If TypeOf Screen.ActiveControl Is TextBox Then
Screen.ActiveControl.SelText = ""
ElseIf TypeOf Screen.ActiveControl Is ComboBox Then
Screen.ActiveControl.Text = ""
ElseIf TypeOf Screen.ActiveControl Is PictureBox _
Then
Screen.ActiveControl.Picture = LoadPicture()
ElseIf TypeOf Screen.ActiveControl Is ListBox Then
Screen.ActiveControl.RemoveItem Screen.ActiveControl.ListIndex
Else
'无操作响应其它控件。
End If
End Sub
Private Sub mnuPaste_Click ()
If TypeOf Screen.ActiveControl Is TextBox Then
Screen.ActiveControl.SelText = Clipboard.GetText()
ElseIf TypeOf Screen.ActiveControl Is ComboBox Then
Screen.ActiveControl.Text = Clipboard.GetText()
ElseIf TypeOf Screen.ActiveControl Is PictureBox _
Then
Screen.ActiveControl.Picture = _
Clipboard.GetData()
ElseIf TypeOf Screen.ActiveControl Is ListBox Then
Screen.ActiveControl.AddItem Clipboard.GetText()
Else
'对其它控件没有意义的动作。
End If
End Sub