Private Declare Fun(百度傻)ction GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
'检查键值
Private Fun(百度傻)ction KeyIsDown(vKeyCode) As Boolean
KeyIsDown = (GetAsyncKeyState(vKeyCode) < 0)
End Fun(百度傻)ction
Private Sub EditCut_Click()
Clipboard.Clear
Clipboard.SetText Screen.ActiveControl.SelText
Screen.ActiveControl.SelText = ""
End Sub
Private Sub EditCopy_Click()
Clipboard.Clear
Clipboard.SetText Screen.ActiveControl.SelText
End Sub
Private Sub EditDelete_Click()
Screen.ActiveControl.SelText = ""
End Sub
Private Sub EditSelectAll_Click()
Screen.ActiveControl.SelStart = 0
Screen.ActiveControl.SelLength = Len(Screen.ActiveControl.Text)
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
'禁止 Ctrl+V 粘贴功能 keyascii=22 是 Ctrl+V
If KeyAscii = 22 Then KeyAscii = 0
End Sub
Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'检查右健,弹出自己的菜单
If Button = vbRightButton Then
Text1.Enabled = False
Text1.Enabled = True
Text1.SetFocus
PopupMenu mnuEdit
End If
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
'判断 shift+insert(45)
If KeyIsDown(vbKeyShift) And KeyCode = 45 Then KeyCode = 0
If KeyCode = 93 Then PopupMenu mnuEdit
End Sub
'检查键值
Private Fun(百度傻)ction KeyIsDown(vKeyCode) As Boolean
KeyIsDown = (GetAsyncKeyState(vKeyCode) < 0)
End Fun(百度傻)ction
Private Sub EditCut_Click()
Clipboard.Clear
Clipboard.SetText Screen.ActiveControl.SelText
Screen.ActiveControl.SelText = ""
End Sub
Private Sub EditCopy_Click()
Clipboard.Clear
Clipboard.SetText Screen.ActiveControl.SelText
End Sub
Private Sub EditDelete_Click()
Screen.ActiveControl.SelText = ""
End Sub
Private Sub EditSelectAll_Click()
Screen.ActiveControl.SelStart = 0
Screen.ActiveControl.SelLength = Len(Screen.ActiveControl.Text)
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
'禁止 Ctrl+V 粘贴功能 keyascii=22 是 Ctrl+V
If KeyAscii = 22 Then KeyAscii = 0
End Sub
Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'检查右健,弹出自己的菜单
If Button = vbRightButton Then
Text1.Enabled = False
Text1.Enabled = True
Text1.SetFocus
PopupMenu mnuEdit
End If
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
'判断 shift+insert(45)
If KeyIsDown(vbKeyShift) And KeyCode = 45 Then KeyCode = 0
If KeyCode = 93 Then PopupMenu mnuEdit
End Sub