本文整理汇总了VB.NET中System.Windows.Forms.Control.OnEnter方法的典型用法代码示例。如果您正苦于以下问题:VB.NET Control.OnEnter方法的具体用法?VB.NET Control.OnEnter怎么用?VB.NET Control.OnEnter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。
在下文中一共展示了Control.OnEnter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1:
Private Sub textBox1_Enter(sender As Object, e As System.EventArgs) Handles textBox1.Enter
' If the TextBox contains text, change its foreground and background colors.
If textBox1.Text <> [String].Empty Then
textBox1.ForeColor = Color.Red
textBox1.BackColor = Color.Black
' Move the selection pointer to the end of the text of the control.
textBox1.Select(textBox1.Text.Length, 0)
End If
End Sub
Private Sub textBox1_Leave(sender As Object, e As System.EventArgs) Handles textBox1.Leave
' Reset the colors and selection of the TextBox after focus is lost.
textBox1.ForeColor = Color.Black
textBox1.BackColor = Color.White
textBox1.Select(0, 0)
End Sub
End Class