11-06-2012، 02:44 PM
Disable TextBox control's right click context menu to appear without using any API.... There are several other hard ways to do this (like SendMessage, Hooking etc.) But here is the most simple three line code you can use in your application - No API !
Only thing to remember while using this code is - there should at least be one more control on your VB form other than your text box control and textbox's tabindex should not be 0 !
با سورس زیر یاد میگیرید چه چگونه کلیک راست را بر روی تکست باکس غیر فعال کنید :
Only thing to remember while using this code is - there should at least be one more control on your VB form other than your text box control and textbox's tabindex should not be 0 !
با سورس زیر یاد میگیرید چه چگونه کلیک راست را بر روی تکست باکس غیر فعال کنید :
کد:
Dim bIsRightClk As Boolean
Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
bIsRightClk = True
End If
End Sub
Private Sub Form_Load()
bIsRightClk = False
End Sub
Private Sub Text1_GotFocus()
If bIsRightClk = True Then
Text1.Enabled = False
Me.SetFocus
Text1.Enabled = True
End If
End Sub
گروه دور همی پارسی کدرز
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg