包括左右击,拖拽。谢了

解决方案 »

  1.   

    忘了说明了,这个texbox还是要求能用键盘输入的
      

  2.   

    Locked 
    决定控件是否可编辑
      

  3.   

    在textbox所在form中加入下面的代码
    Private Sub Form_Load()
       preWndProc = SetWindowLong(Text1.hwnd, (-4), AddressOf WndProc)
    End SubPrivate Sub Form_Terminate()
        SetWindowLong Text1.hwnd, (-4), preWndProc
    End Sub在模块中加入下面的代码
    Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As LongPublic preWndProc As LongPublic Function WndProc(ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
        
        If (Msg = &H200 Or Msg = &H203 Or Msg = &H204 Or Msg = &H205 Or Msg = &H206) Then    Else
            WndProc = CallWindowProc(preWndProc, hwnd, Msg, wParam, lParam)
        End If
    End Functiontext1为需要屏蔽鼠标的textbox
    该代码完全屏蔽了鼠标右键,左键只可以使text1获得焦点,如果连焦点也不要获得,则最后第五行修改为:
    If (Msg = &H200 Or Or Msg = &H201 Or Msg = &H202 Msg = &H203 Or Msg = &H204 Or Msg = &H205 Or Msg = &H206) Then