Discussion:
在TEXTBOX如取消右鍵的功能
(时间太久无法回复)
嫩B程式設計師
2005-02-22 02:59:02 UTC
Permalink
小弟目前在TEXTBOX中須要限制輸入的格式與內容
在鍵盤的限制方面已經完成.
但是..無法限制使用右鍵或右鍵的貼上功能
在MUOSE DOWN中已知道右鍵為2...

依照盤的的鎖定方式
if button=2 then
end if

是這樣寫嗎???已經卡住了
我只要右鍵不能貼上就好...不管是鎖右鍵..取消貼上等..都可
請各位前輩指導
Lee,Hou-Hsien 李後賢
2005-02-22 05:25:02 UTC
Permalink
在 TextBox 的 MouseDown 事件中進行處理

Private Sub TextBox1_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseDown
If (e.Button = MouseButtons.Right) Then
MessageBox.Show("MouseButtons.Right")
Return
End If
End Sub


Lee,Hou-Hsien


"嫩B程式設計師" 來函:
Post by 嫩B程式設計師
小弟目前在TEXTBOX中須要限制輸入的格式與內容
在鍵盤的限制方面已經完成.
但是..無法限制使用右鍵或右鍵的貼上功能
在MUOSE DOWN中已知道右鍵為2...
依照盤的的鎖定方式
if button=2 then
end if
是這樣寫嗎???已經卡住了
我只要右鍵不能貼上就好...不管是鎖右鍵..取消貼上等..都可
請各位前輩指導
嫩B程式設計師
2005-02-22 09:39:02 UTC
Permalink
感謝前輩的指導
根据語法上來看~~前輩指的不知否為VBNET
這邊是小弟的錯~~小弟使用的是VB

使用前輩的語法會出現"使用者型態尚未定義"

所以小弟提取前輩的精華~~用msgbox來代替原先右鍵功能

以下是VB6的代源碼:

Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
If (Button = 2) Then
MsgBox "MouseButtons.Right"
End If

End Sub




"Lee,Hou-Hsien 李後賢" 來函:
Post by Lee,Hou-Hsien 李後賢
在 TextBox 的 MouseDown 事件中進行處理
Private Sub TextBox1_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseDown
If (e.Button = MouseButtons.Right) Then
MessageBox.Show("MouseButtons.Right")
Return
End If
End Sub
Lee,Hou-Hsien
"嫩B程式設計師" 來函:
Post by 嫩B程式設計師
小弟目前在TEXTBOX中須要限制輸入的格式與內容
在鍵盤的限制方面已經完成.
但是..無法限制使用右鍵或右鍵的貼上功能
在MUOSE DOWN中已知道右鍵為2...
依照盤的的鎖定方式
if button=2 then
end if
是這樣寫嗎???已經卡住了
我只要右鍵不能貼上就好...不管是鎖右鍵..取消貼上等..都可
請各位前輩指導
Loading...