Tool Time Tips

The ToolTip class provides the mechanism by which we can pop-up a small, non-modal window (i.e. it doesn't render the rest of the application inactive) that we often use to provide additional explanation of features within the UI or definitions for fields. This is precisely what pops up when you hover the mouse over the (?) icon in forms in order to remember what the heck a CVV number on a credit card is — its the three digit number found on the back of Visa cards and on the right-side of the face of American Express cards.

Now, that explanation would be a waste of your time if you already knew what a CVV number was, so my hard-coding it into the document not only took up valuable screen real estate, but may have seemed like I was insulting your intelligence as a functional adult in today's modern world. The better implementation would be to hide it behind an icon (the (?) conventionally represents the "hover the mourse cursor here to learn more" icon, which also means you shouldn't use this icon without a corresponding ToolTip to go with it), allowing for well-informed users to simply skip past that explanation.

Some of the properties you will likely want to manipulate for each tooltip include BackColor — you don't want the same background color as the default background, but not necessarily one with high contrast; ForeColor; int InitialDelay, which measures how many milliseconds the cursor must be stationary on the control before the ToolTip appears; int AutoPopDelay is the length of time the ToolTip will remain visible; int ReshowDelay, which describes the amount of time (in milliseconds) between appearances of the ToolTip; and bool OwnderDraw, which indicates whether the ToolTip will be drawn by the operating system (false), or by the code you provide (true).

The public void SetToolTip(Control c, string caption) will be how we define the content of a ToolTip, as well as what control element will produce it.