C#中文本框中的水印

问题描述:

您好,

我想问一下如何编程方式使文本显示在文本框中,如在此输入用户名,并在用户实际输入该文本框中的内容时使该教学文本清晰。

我想在C#Windows窗体应用程序中执行此操作。



谢谢!

Hello,
I want to ask how one can programatically make a text appear in a textbox like "Type user name here" and make that instructional text clear as the user actually enters something into that textbox.
I want to do this in a C# Windows Forms application.

Thanks!

我希望这就是你所需要的:



[ TextBoxWatermark Demonstration ]



这对你有帮助!
I hope this is what you need:

[TextBoxWatermark Demonstration]

That should help you!


请查看这个



使用C#,.NET 3.5的桌面应用程序的WaterMark TextBox和VS2008 [ ]


这里有一篇关于CP的文章这样做:自定义TextBox与水印 [ ^ ]。



问候,

- Manfred
There is an article here on CP that does this: Custom TextBox with Watermark[^].

Regards,
— Manfred