本文整理匯總了VB.NET中System.Windows.Forms.Control.Leave事件的典型用法代碼示例。如果您正苦於以下問題:VB.NET Control.Leave事件的具體用法?VB.NET Control.Leave怎麽用?VB.NET Control.Leave使用的例子?那麽, 這裏精選的事件代碼示例或許可以為您提供幫助。
在下文中一共展示了Control.Leave事件的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