简单的如何使这是通过点击它禁用的文本框?这是怎么做的?
Simple how to enable a Textbox which is disabled by clicking on it? how is this done?
我的code不起作用
Private Sub Textbox1_MouseClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Textbox1.MouseClick
Textbox1.Enabled = True
End Sub
谁能帮我。
我必须诉诸跟踪鼠标点击和X,文本框与计时器等的Y位置..没有事件从点击它解雇了?
Do I have to resort to tracking the mouse clicks and X,Y positions of textbox with timers etc.. no events are fired from clicking it?
您可以使用IMessageFilter来捕获WM_LBUTTONDOWN消息,然后检查是否光标在文本框之内......是这样的:
You can use IMessageFilter to trap WM_LBUTTONDOWN messages and then check to see if the cursor is within the TextBox...something like:
Public Class Form1
Private WithEvents filter As New MyFilter
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
TextBox1.Enabled = False
Application.AddMessageFilter(filter)
End Sub
Private Sub filter_LeftClick() Handles filter.LeftClick
Dim rc As Rectangle = TextBox1.RectangleToScreen(TextBox1.ClientRectangle)
If rc.Contains(Cursor.Position) AndAlso Not TextBox1.Enabled Then
TextBox1.Enabled = True
TextBox1.Focus()
End If
End Sub
Private Class MyFilter
Implements IMessageFilter
Public Event LeftClick()
Private Const WM_LBUTTONDOWN As Integer = &H201
Public Function PreFilterMessage(ByRef m As System.Windows.Forms.Message) As Boolean Implements System.Windows.Forms.IMessageFilter.PreFilterMessage
Select Case m.Msg
Case WM_LBUTTONDOWN
RaiseEvent LeftClick()
End Select
Return False
End Function
End Class
End Class
上一篇:使用 PHP composer 克隆 git repocomposer、PHP、repo、git
下一篇:composer.json 中的 require 和 require-dev 部分有什么区别?有什么区别、部分、json、composer