如何实现显示&QUOT一个文本框,在此键入"? [英] How do I implement a TextBox that displays "Type here"?
问题描述
显示的键入这里... 的,直到用户输入文本成文本框
是时下一个众所周知的可用性功能。如何将一个C#实现这个功能吗?
Displaying "Type here to ..." until the user enters text into a TextBox
is a well-known usability feature nowadays. How would one implement this feature in C#?
我的想法是覆盖 OnTextChanged
,而是从和处理文本的变化逻辑的在此键入是一个有点棘手...
My idea is to override OnTextChanged
, but the logic to handle the changes of text from and to "Type here" is a bit tricky...
显示的在此输入的关于初始化和第一次输入删除它很容易,但我希望每一个输入的文本为空时要显示的消息。
Displaying "Type here" on initialization and removing it on first input is easy, but I want to display the message every time the entered text becomes empty.
推荐答案
什么你要找的是一个texbox水印
What you're looking for is a texbox with "watermark"
有对C#一个样本实现这里。
希望它能帮助
这篇关于如何实现显示&QUOT一个文本框,在此键入"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!