一个VB程序设计
设计一个复制文本的演示程序,设计界面如图所示要求:(1)程序刚运行时2个命令按钮均不能响应(灰色,不能使用(2)当选定文本框内文字之后(被选定的文本长度SelLength...
设计一个复制文本的演示程序,设计界面如图所示
要求:(1)程序刚运行时2个命令按钮均不能响应(灰色,不能使用
(2) 当选定文本框内文字之后(被选定的文本长度SelLength应大于0),“复制”按钮能够响应(提示:用鼠标选定文本会触发MouseUp事件;SelText属性表示选定文本内容)
(3)单击“复制”按钮,只有“粘贴”按钮能够响应
(4)单击“粘贴”按钮,已选定的文本复制到下面的文本框上,同时2个按钮不能响应 展开
要求:(1)程序刚运行时2个命令按钮均不能响应(灰色,不能使用
(2) 当选定文本框内文字之后(被选定的文本长度SelLength应大于0),“复制”按钮能够响应(提示:用鼠标选定文本会触发MouseUp事件;SelText属性表示选定文本内容)
(3)单击“复制”按钮,只有“粘贴”按钮能够响应
(4)单击“粘贴”按钮,已选定的文本复制到下面的文本框上,同时2个按钮不能响应 展开
4个回答
展开全部
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 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
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐于2018-05-18
展开全部
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
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
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
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询