vb.net 怎么判断文本框 失去焦点 ? 怎么在代码中定义控件的坐标
展开全部
Public Class Form3
按下,显示控件,并获得焦点.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Visible = True
TextBox1.Focus()
End Sub
判断是否获得焦点.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If TextBox1.Focused = True Then
MessageBox.Show("已经获得焦点了.")
Else
MessageBox.Show("已经失去焦点了.")
End If
End Sub
失去焦点后自动陷藏.
Private Sub TextBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.LostFocus
TextBox1.Visible = False
End Sub
End Class
按下,显示控件,并获得焦点.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Visible = True
TextBox1.Focus()
End Sub
判断是否获得焦点.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If TextBox1.Focused = True Then
MessageBox.Show("已经获得焦点了.")
Else
MessageBox.Show("已经失去焦点了.")
End If
End Sub
失去焦点后自动陷藏.
Private Sub TextBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.LostFocus
TextBox1.Visible = False
End Sub
End Class
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询