查看: 324  |  回复: 0
  VB6 用ClipBoard复制文字到剪切板
楼主
发表于 2023年11月22日 22:39

新建From1(窗体),新建Text1(TextBox),Command1、Command2(按钮CommandButton),代码:

Private Sub Command1_Click()
    '复制
    If Text1.SelText <> "" Then Clipboard.SetText Text1.SelText
End Sub

Private Sub Command2_Click()
    '剪切
    If Text1.SelText <> "" Then Clipboard.SetText Text1.SelText: Text1.SelText = ""
End Sub

Private Sub Form_Load()
    Text1.Text = "12345abc6789"
End Sub


您需要登录后才可以回帖 登录 | 立即注册
【本版规则】请勿发表违反国家法律的内容,否则会被冻结账号和删贴。
用户名: 立即注册
密码:
2020-2024 MaNongKu.com