vb求助啊~~~ vb高手请进!!!
关于用richtextbox对象那为高手能帮我写出关于对与它的粘贴,复制,剪切,撤消,重复的实现代码啊!写出的送20分...
关于用richtextbox对象
那为高手能帮我写出关于对与它的粘贴,复制,剪切,撤消,重复的实现代码啊!写出的送20分 展开
那为高手能帮我写出关于对与它的粘贴,复制,剪切,撤消,重复的实现代码啊!写出的送20分 展开
展开全部
这是我以前写的可以通用。
关于撤销和重复 我再给你写。
Private Sub 复制_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 PictureBox Then
Clipboard.SetText Screen.ActiveControl.Text
ElseIf TypeOf Screen.ActiveControl Is DBGrid Then
If DBGrid1.AllowUpdate = True Then Clipboard.SetText Screen.ActiveControl.Text
End If
End Sub
Private Sub 剪切_Click()
复制_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
ElseIf TypeOf Screen.ActiveControl Is DBGrid Then
If DBGrid1.AllowUpdate = True Then Screen.ActiveControl.Text = ""
End If
End Sub
Private Sub 粘贴_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.Text = Clipboard.GetData()
ElseIf TypeOf Screen.ActiveControl Is ListBox Then
Screen.ActiveControl.Text = Clipboard.GetText()
ElseIf TypeOf Screen.ActiveControl Is DBGrid Then
If DBGrid1.AllowUpdate = True Then Screen.ActiveControl.Text = Clipboard.GetText()
End If
关于撤销和重复 我再给你写。
Private Sub 复制_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 PictureBox Then
Clipboard.SetText Screen.ActiveControl.Text
ElseIf TypeOf Screen.ActiveControl Is DBGrid Then
If DBGrid1.AllowUpdate = True Then Clipboard.SetText Screen.ActiveControl.Text
End If
End Sub
Private Sub 剪切_Click()
复制_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
ElseIf TypeOf Screen.ActiveControl Is DBGrid Then
If DBGrid1.AllowUpdate = True Then Screen.ActiveControl.Text = ""
End If
End Sub
Private Sub 粘贴_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.Text = Clipboard.GetData()
ElseIf TypeOf Screen.ActiveControl Is ListBox Then
Screen.ActiveControl.Text = Clipboard.GetText()
ElseIf TypeOf Screen.ActiveControl Is DBGrid Then
If DBGrid1.AllowUpdate = True Then Screen.ActiveControl.Text = Clipboard.GetText()
End If
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询