Option Explicit
Private Sub Form_Load()
Text1.ForeColor = &H80000010
Text1.Text = "显示灰色提示文字"
End Sub
Private Sub Text1_GotFocus()
Text1.Text = ""
Text1.ForeColor = &H80000012
End Sub
Private Sub Text1_LostFocus()
If Len(Text1.Text) = 0 Then
Text1.Text = "显示灰色提示文字"
Text1.ForeColor = &H80000010
End If
End Sub
有focus吗?如果有的话就在里面写就行了。focus之前显示灰色字体,focus之后文本设为空,更改颜色。。