VB中,如何实现:当鼠标点击文本框时,文本框内的提示字符会自动消隐
4个回答
2013-09-21
展开全部
代码 Option Explicit
Dim defs As String
Private Sub Form_Activate()
defs = "请在这里输入" '定义提示字符
Command1.SetFocus '给按钮置焦点
End Sub
Private Sub Text1_GotFocus() '文本框得到焦点
If Text1 = defs Then Text1 = ""
End SubPrivate Sub Text1_LostFocus() '文本框失去焦点
If Text1 = "" Then Text1 = defs
End Sub
Dim defs As String
Private Sub Form_Activate()
defs = "请在这里输入" '定义提示字符
Command1.SetFocus '给按钮置焦点
End Sub
Private Sub Text1_GotFocus() '文本框得到焦点
If Text1 = defs Then Text1 = ""
End SubPrivate Sub Text1_LostFocus() '文本框失去焦点
If Text1 = "" Then Text1 = defs
End Sub
2013-09-21
展开全部
Private Sub Text1_Click()
Text1.Text = ""
End Sub
Text1.Text = ""
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-09-21
展开全部
在控件的点击事件中设置文本框内容为空。比如on txttest clickset txttest.text=''
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-09-21
展开全部
Dim str
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
ToolTipText = str
End SubPrivate Sub Text1_Click()
str = ToolTipText
Text1.ToolTipText = ""
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
ToolTipText = str
End SubPrivate Sub Text1_Click()
str = ToolTipText
Text1.ToolTipText = ""
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询