单击两个控件都处于禁用状态的组合框或文本框后,如何输出消息框。任何方法将不胜感激!谢谢
问问题
626 次
1 回答
0
您可以使用表单 MouseDown 事件:
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
If TextBox1.Enabled = False AndAlso _
e.X >= TextBox1.Left And e.X <= TextBox1.Left + TextBox1.Width AndAlso _
e.Y >= TextBox1.Top And e.Y <= TextBox1.Top + TextBox1.Height Then
MsgBox("The textbox is disabled")
End If
If ComboBox1.Enabled = False AndAlso _
e.X >= ComboBox1.Left And e.X <= ComboBox1.Left + ComboBox1.Width AndAlso _
e.Y >= ComboBox1.Top And e.Y <= ComboBox1.Top + ComboBox1.Height Then
MsgBox("The combobox is disabled")
End If
End Sub
于 2013-09-28T18:53:18.880 回答