ProblemYou want a tooltip to appear when the user hovers the cursor (mouse) over a control. SolutionUse the ToolTip control, included in the Windows Forms Toolbox, on your form. Figure 14-9 shows the ToolTip control in the Toolbox and applied to the form. Figure 14-9. The ToolTip control added to a formDiscussionWhen applied to a form, the ToolTip control enhances all displayable on-form controls, adding a new pseudoproperty to the properties collection of each control. If you add a ToolTip control named ToolTip1 to the form, each visible control includes a new "ToolTip on ToolTip1" property. For a specific control, fill this pseudoproperty with the text to display in the tooltip. Figure 14-10 shows a tooltip in use on a running form. Figure 14-10. A tooltip in useNormally, adding a single ToolTip control to a form is sufficient for all your tooltip display needs. While each control communicates its own tooltip display text through the added ToolTip pseudoproperty, the ToolTip control itself manages how that text gets displayed, through its own property settings. For instance, the IsBalloon property, when set to true, displays the tooltip in a balloon display instead of a plain square (see Figure 14-11). Figure 14-11. A balloon-shaped tooltipYou can also take full control of the drawing of the tooltip by setting its OwnerDraw property to TRue and responding to the control's Draw event. See Chapter 9 for examples of drawing to a custom graphics surface. See AlsoRecipe 14.11 shows how to add tooltips to notification icons in the System Tray. |