在VB中可以编辑文字的情况下右键选中文字或者CTRL+C禁止复制
怎么实现

解决方案 »

  1.   

    rivate Sub Text1_KeyPress(KeyAscii As Integer)
      If KeyAscii = 3 Then Clipboard.Clear    '3 is keyascii of "Ctrl + C"
    End SubPrivate Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
      If Button = 2 Then MsgBox "Error": Exit Sub '转移焦点,使右键失效
    End Sub
      

  2.   

    上面的错了,应该这样
      Private Sub Text1_KeyPress(KeyAscii As Integer)
      If KeyAscii = 3 Then x = True  '3 is keyascii of "Ctrl + C"
      
    End SubPrivate Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
      If x = True Then Clipboard.Clear: x = False
    End SubPrivate Sub Text1_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
      If Button = 2 Then MsgBox "Error": Exit Sub '转移焦点,使右键失效
    End SubClipboard.Clear 写在Key_up 才有效!!