CueProvider is a tiny class that lets you set a cue banner (the grey prompt text that automatically disappears when you begin to type) in a
How to use CueProvider
CueProvider is easy to use, and has just two methods - one to set a
TextBox's cue text, the other to clear it. To set the cue text, call
SetCue(); to clear it, call
ClearCue(). These calls are best placed in your form's
CueProvider.SetCue (theTextBox, theCueText);
How it works
CueProvider works by sending the
EM_SETCUEBANNER message. The message is sent using the
SendMessage() Win32 API. More information on the
EM_SETCUEBANNER message can be found on this MSDN page.
As you can see, there's nothing overly complicated in this class. I put
CueBanner together in a few minutes, and wanted to share it with the CodeProject community in the hope it could help give our desktop apps a bit of UI "polish".
Ravi Bhavnani is an ardent fan of Microsoft technologies who loves building Windows apps, especially PIMs, system utilities, and things that go bump on the Internet. During his career, Ravi has developed expert systems, desktop imaging apps, marketing automation software, EDA tools, a platform to help people find, analyze and understand information, trading software for institutional investors and advanced data visualization solutions. He currently works for a company that provides enterprise workforce management solutions to large clients.
His interests include the .NET framework, reasoning systems, financial analysis and algorithmic trading, NLP, CHI and UI design. Ravi holds a BS in Physics and Math and an MS in Computer Science and was a Microsoft MVP (C++ and C# in 2006 and 2007). He is also the co-inventor of 2 patents on software security and generating data visualization dashboards. His claim to fame is that he crafted CodeProject's "joke" forum post icon.
Ravi's biggest fear is that one day he might actually get a life, although the chances of that happening seem extremely remote.