(Lock屬性只是讓
文本框不能接收用戶輸入,但還是可以粘貼的。)在窗體中畫一個(gè)文本框,打開
代碼窗口,把代碼復(fù)制進(jìn)去:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 3 Then
MsgBox "請(qǐng)勿非法復(fù)制!"
KeyAscii = 0
ElseIf KeyAscii = 22 Then
MsgBox "請(qǐng)勿非法粘貼!"
KeyAscii = 0
End If
End Sub
Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
MsgBox "禁止在文本框中使用右鍵!"
End If
End Sub