Super Tooltip
An Office-style "super tool tip": a tool tip with a title, a body of several lines with an optional picture, a footer, icons, and a gradient or solid background – one component that gives a rich tip to any number of controls on a form.
Assembly
| Assembly | Binarymission.WinForms.Controls.BinarySuperToolTip.dll |
| Root namespace | Binarymission.WinForms.Controls.Popups |
| Target frameworks | .NET Framework 4.8, .NET 6 / 8 / 10 |
Overview
Use it where a one-line tool tip is not enough to explain a command: what it does, what it
affects, a preview, and where to find more help. Drop one component on a form, and every control on the
form gains a set of "on superToolTip1" properties in the Properties window; in code, call the
SetBinarySuperToolTip... methods with the control and the value.
The parts of a tip
- Title –
SetBinarySuperToolTipTitleText, with an optional icon (SetBinarySuperToolTipTitleIcon, shown whenSetBinarySuperToolTipDrawTitleIconis on). - Body –
SetBinarySuperToolTipBodyText, with an optional picture at its left (SetBinarySuperToolTipBodyImage). Setting the body text is what turns the tip on for a control; a control with no body text shows no tip. - Footer –
SetBinarySuperToolTipFooterText, with an optional icon and a line above it (SetBinarySuperToolTipDrawLineSeparatingBodyAndFooterArea).
The tip is sized to fit these each time it opens, up to half the screen's working area each way,
unless it is given a fixed size (SetBinarySuperToolTipUseCustomSizing,
SetBinarySuperToolTipCustomSize).
Colours
Either choose one of the built-in ColorScheme values – a gradient from the scheme's
colour to the window colour, with text and borders in the window text colour – or set the background
(SetBinarySuperToolTipBackgroundDrawingStyle and its colours), the text colours and fonts,
and the border yourself. To use a built-in scheme, set the background style to
DrawingStyle.Gradient first.
Timing and custom drawing
When and for how long tips show is the standard ToolTip behaviour:
ToolTip.InitialDelay, ToolTip.AutoPopDelay and the rest work as usual.
AboutToPopup lets you cancel a tip as it opens, and HeaderDraw,
BodyDraw and FooterDraw let you draw any region yourself.
Getting started
A rich tip for a "Send invoice" button, in the built-in blue scheme.
using System;
using System.Drawing;
using System.Windows.Forms;
using Binarymission.WinForms.Controls.Popups;
public class InvoiceForm : Form
{
private readonly BinarySuperToolTip _tips = new BinarySuperToolTip();
private readonly Button _send = new Button { Text = "Send", Location = new Point(16, 16) };
public InvoiceForm()
{
Controls.Add(_send);
_tips.InitialDelay = 600;
_tips.AutoPopDelay = 15000;
_tips.SetBinarySuperToolTipBackgroundDrawingStyle(_send, DrawingStyle.Gradient);
_tips.SetBinarySuperToolTipBuiltInColorScheme(_send, ColorScheme.Blue);
_tips.SetBinarySuperToolTipTitleText(_send, "Send invoice");
_tips.SetBinarySuperToolTipTitleTextFont(_send, new Font("Segoe UI", 10f, FontStyle.Bold));
_tips.SetBinarySuperToolTipTitleIcon(_send, SystemIcons.Information);
_tips.SetBinarySuperToolTipDrawTitleIcon(_send, true);
_tips.SetBinarySuperToolTipBodyText(_send,
"Emails this invoice as a PDF to the customer's billing contact." + Environment.NewLine +
"The invoice is then marked as sent and can no longer be edited.");
_tips.SetBinarySuperToolTipFooterText(_send, "Press F1 for more help");
_tips.SetBinarySuperToolTipFooterIcon(_send, SystemIcons.Question);
_tips.SetBinarySuperToolTipDrawFooterIcon(_send, true);
_tips.SetBinarySuperToolTipDrawLineSeparatingBodyAndFooterArea(_send, true);
}
}API reference
Binarymission.WinForms.Controls.Popups
delegate AboutToPopupHandler | Represents the method that handles AboutToPopup, raised before a tool tip opens. |
class BinarySuperToolTip | An Office-style "super tool tip": a tool tip with a title, a body of several lines with an optional picture, a footer, icons, and a gradient or solid background - one component that gives a rich tip to any number of controls on a form. |
class BinarySuperToolTipDrawingEventArgs | Provides data for HeaderDraw, BodyDraw and FooterDraw: the surface and rectangle to draw a region of a tip in, and a way to say it has been drawn. |
class BinarySuperToolTipPopupEventArgs | Provides data for AboutToPopup: which control's tip is opening, and a way to stop it. |
class BinarySuperToolTipPropertiesEditor | The design-time dialog that edits a super tool tip's content and appearance. The designer opens it from the property grid; it is not meant to be shown at run time. |
delegate BodyDrawingHandler | Represents the method that handles BodyDraw, raised before the tool tip's body is drawn. |
enum ColorScheme | Specifies a built-in colour scheme for a BinarySuperToolTip tip. |
enum DrawingStyle | Specifies how the background of a BinarySuperToolTip tip is filled. |
delegate FooterDrawingHandler | Represents the method that handles FooterDraw, raised before the tool tip's footer is drawn. |
delegate HeaderDrawingHandler | Represents the method that handles HeaderDraw, raised before the tool tip's title area is drawn. |