1、添加两个文本框和两个命令按钮,把两文本框的text属性中的Text1和Text2删除,再把命令按钮1的Caption属性改为“复制”,命令按钮2的Caption属性改为“粘贴”。2、源代码如下: Private Sub Command1_Click()Command2.Enabled = TrueCommand1.Enabled = FalseEnd Sub
Private Sub Command2_Click()Text2.Text = Text1.SelTextCommand1.Enabled = FalseCommand2.Enabled = FalseEnd Sub
Private Sub Form_Load()Command1.Enabled = FalseCommand2.Enabled = FalseEnd Sub
Private Sub Text1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)If Text1.SelLength > 0 ThenCommand1.Enabled = TrueEnd IfEnd Sub
Private Sub Command1_Click()
Command2.Enabled = True
End Sub
Private Sub Command2_Click()
Text2.Text = Text1.SelText
Command1.Enabled = False
Command2.Enabled = False
End Sub
Private Sub Form_Load()
Command1.Enabled = False
Command2.Enabled = False
End Sub
Private Sub Text1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)If Text1.SelLength > 0 Then
Command1.Enabled = True
End If
End Sub
Private Sub Form_Load()
Command1.Enabled = False
Command2.Enabled = False
Text1 = "复制文本的演示程序"
Text2 = ""
End Sub
Private Sub Text1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Text1.SelText = "" Then
Else
Command1.Enabled = True
End If
End Sub
Private Sub Command1_Click()
Clipboard.SetText Text1.SelText
Command1.Enabled = False
Command2.Enabled = True
End Sub
Private Sub Command2_Click()
Text2 = Clipboard.GetText
Command2.Enabled = False
End Sub