📜  如何在 TextBox vb.net 中创建提示、占位符文本、水印 - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:08.334000             🧑  作者: Mango

代码示例1
Private Sub TextBox1_MouseEnter(Sender As Object, e As EventArgs) Handles TextBox1.MouseEnter
        If TextBox1.Text = "Enter your first name" Then
            TextBox1.Text = ""
            TextBox1.ForeColor = Color.Black
        End If
    End Sub
    Private Sub TextBox1_MouseLeave(sender As Object, e As EventArgs) Handles TextBox1.MouseLeave
        If TextBox1.Text = "" Then
            TextBox1.Text = "Enter your first name"
            TextBox1.ForeColor = Color.Gray
        End If
    End Sub