基本上,我已经创建了一个用户表单,我想知道是否可以添加灰色文本,这些文本在用户表单加载时存在,但在用户开始向TextBox中输入文本时就消失了:
图像已过期
一旦用户开始输入字体,颜色就会变为黑色。
任何帮助都将不胜感激。
发布于 2014-02-04 03:48:38
像这样的东西?
Private Sub UserForm_Initialize()
TextBox1.ForeColor = &HC0C0C0 '<~~ Grey Color
TextBox1.Text = "Please Enter Name Here"
CommandButton1.SetFocus '<~~ This is required so that the focus moves from TB
End Sub
Private Sub TextBox1_Enter()
With TextBox1
If .Text = "Please Enter Name Here" Then
.ForeColor = &H80000008 '<~~ Black Color
.Text = ""
End If
End With
End Sub
Private Sub TextBox1_AfterUpdate()
With TextBox1
If .Text = "" Then
.ForeColor = &HC0C0C0
.Text = "Please Enter Name Here"
End If
End With
End SubScreenShot (实际操作)

https://stackoverflow.com/questions/21536192
复制相似问题