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.
public partial class BinarySuperToolTip : System.Windows.Forms.ToolTip, IExtenderProvider
Inherits from / implements: System.Windows.Forms.ToolTip, IExtenderProvider
Remarks
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.
Examples
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);
}
}See also
Members at a glance
| Constructors | |
|---|---|
BinarySuperToolTip | Initialises a new super tool tip component, with no tips set for any control yet. |
| Properties | |
OwnerDraw | Gets a value that is always true: the component always draws its tips itself. |
| Methods | |
GetBinarySuperToolTipBackgroundDrawingGradientEndColor | Gets the colour a gradient background of control's tool tip ends with. |
GetBinarySuperToolTipBackgroundDrawingGradientStartColor | Gets the colour a gradient background of control's tool tip starts from. |
GetBinarySuperToolTipBackgroundDrawingSolidColor | Gets the background colour of control's tool tip when it is drawn solid. |
GetBinarySuperToolTipBackgroundDrawingStyle | Gets whether the background of control's tool tip is a gradient or a solid colour. |
GetBinarySuperToolTipBodyFooterSeparatingLineDepth | Gets the thickness of the line between the body and the footer of control's tool tip. |
GetBinarySuperToolTipBodyImage | Gets the picture shown at the left of the body of control's tool tip. |
GetBinarySuperToolTipBodyImageTransparencyColor | Gets the colour made see-through in the body picture of control's tool tip. |
GetBinarySuperToolTipBodyText | Gets the main text of control's tool tip. |
GetBinarySuperToolTipBodyTextFont | Gets the font of the body text in control's tool tip. |
GetBinarySuperToolTipBodyTextForeColor | Gets the colour of the body text in control's tool tip. |
GetBinarySuperToolTipBorderColor | Gets the colour of the border round control's tool tip. |
GetBinarySuperToolTipBorderColourAroundImage | Gets the colour of the frame round the body picture of control's tool tip. |
GetBinarySuperToolTipBuiltInColorScheme | Gets the built-in colour scheme control's tool tip is drawn in. |
GetBinarySuperToolTipCustomSize | Gets the fixed size of control's tool tip. |
GetBinarySuperToolTipDrawBorder | Gets whether a border is drawn round control's tool tip. |
GetBinarySuperToolTipDrawBorderAroundBodyImage | Gets whether a frame is drawn round the body picture of control's tool tip. |
GetBinarySuperToolTipDrawFooterIcon | Gets whether the footer icon of control's tool tip is shown. |
GetBinarySuperToolTipDrawLineSeparatingBodyAndFooterArea | Gets whether a line is drawn between the body and the footer of control's tool tip. |
GetBinarySuperToolTipDrawTitleIcon | Gets whether the title icon of control's tool tip is shown. |
GetBinarySuperToolTipFooterIcon | Gets the icon shown beside the footer text of control's tool tip. |
GetBinarySuperToolTipFooterText | Gets the text at the foot of control's tool tip. |
GetBinarySuperToolTipFooterTextFont | Gets the font of the footer text in control's tool tip. |
GetBinarySuperToolTipFooterTextForeColor | Gets the colour of the footer text in control's tool tip. |
GetBinarySuperToolTipGradientDrawingOrientationAngle | Gets the direction of the gradient background of control's tool tip. |
GetBinarySuperToolTipLineColorOnTopOfFooterArea | Gets the colour of the line between the body and the footer of control's tool tip. |
GetBinarySuperToolTipTitleIcon | Gets the icon shown beside the title of control's tool tip. |
GetBinarySuperToolTipTitleText | Gets the heading at the top of control's tool tip. |
GetBinarySuperToolTipTitleTextFont | Gets the font of the title text in control's tool tip. |
GetBinarySuperToolTipTitleTextForeColor | Gets the colour of the title text in control's tool tip. |
GetBinarySuperToolTipUseCustomSizing | Gets whether control's tool tip has a fixed size rather than one fitted to its content. |
SetBinarySuperToolTipBackgroundDrawingGradientEndColor | Sets the colour a gradient background of control's tool tip ends with. |
SetBinarySuperToolTipBackgroundDrawingGradientStartColor | Sets the colour a gradient background of control's tool tip starts from. |
SetBinarySuperToolTipBackgroundDrawingSolidColor | Sets the background colour of control's tool tip when it is drawn solid. |
SetBinarySuperToolTipBackgroundDrawingStyle | Sets whether the background of control's tool tip is a gradient or a solid colour. |
SetBinarySuperToolTipBodyFooterSeparatingLineDepth | Sets the thickness of the line between the body and the footer of control's tool tip. |
SetBinarySuperToolTipBodyImage | Sets a picture to show at the left of the body of control's tool tip, beside the body text – a preview, a chart or a screenshot of what the control does. |
SetBinarySuperToolTipBodyImageTransparencyColor | Sets the colour made see-through in the body picture of control's tool tip, so the tip's background shows through it. |
SetBinarySuperToolTipBodyText | Sets the main text of control's tool tip, and so turns the tip on for that control. |
SetBinarySuperToolTipBodyTextFont | Sets the font of the body text in control's tool tip. |
SetBinarySuperToolTipBodyTextForeColor | Sets the colour of the body text in control's tool tip. |
SetBinarySuperToolTipBorderColor | Sets the colour of the border round control's tool tip. |
SetBinarySuperToolTipBorderColourAroundImage | Sets the colour of the frame round the body picture of control's tool tip. |
SetBinarySuperToolTipBuiltInColorScheme | Sets a built-in colour scheme for control's tool tip, in place of individual colours. |
SetBinarySuperToolTipCustomSize | Sets a fixed size for control's tool tip, used while SetBinarySuperToolTipUseCustomSizing is on. |
SetBinarySuperToolTipDrawBorder | Sets whether a border is drawn round control's tool tip. |
SetBinarySuperToolTipDrawBorderAroundBodyImage | Sets whether a one-pixel frame is drawn round the body picture of control's tool tip. |
SetBinarySuperToolTipDrawFooterIcon | Sets whether the footer icon of control's tool tip is shown. |
SetBinarySuperToolTipDrawLineSeparatingBodyAndFooterArea | Sets whether a line is drawn between the body and the footer of control's tool tip. |
SetBinarySuperToolTipDrawTitleIcon | Sets whether the title icon of control's tool tip is shown. |
SetBinarySuperToolTipFooterIcon | Sets the icon shown beside the footer text of control's tool tip – typically a help icon beside "Press F1 for more help". |
SetBinarySuperToolTipFooterText | Sets the text at the foot of control's tool tip – a hint such as "Press F1 for more help" or a keyboard shortcut. |
SetBinarySuperToolTipFooterTextFont | Sets the font of the footer text in control's tool tip. |
SetBinarySuperToolTipFooterTextForeColor | Sets the colour of the footer text in control's tool tip. |
SetBinarySuperToolTipGradientDrawingOrientationAngle | Sets the direction of the gradient background of control's tool tip. |
SetBinarySuperToolTipLineColorOnTopOfFooterArea | Sets the colour of the line between the body and the footer of control's tool tip. |
SetBinarySuperToolTipTitleIcon | Sets the icon shown beside the title of control's tool tip. |
SetBinarySuperToolTipTitleText | Sets the heading at the top of control's tool tip – usually the name of the command. |
SetBinarySuperToolTipTitleTextFont | Sets the font of the title text in control's tool tip. |
SetBinarySuperToolTipTitleTextForeColor | Sets the colour of the title text in control's tool tip. |
SetBinarySuperToolTipUseCustomSizing | Sets whether control's tool tip has a fixed size rather than one fitted to its content. |
| Events | |
AboutToPopup | Occurs just before a tool tip opens, so it can be cancelled or brought up to date. |
BodyDraw | Occurs before the body of a tool tip is drawn, so it can be drawn by your own code instead. |
FooterDraw | Occurs before the footer of a tool tip is drawn, so it can be drawn by your own code instead. |
HeaderDraw | Occurs before the title area of a tool tip is drawn, so it can be drawn by your own code instead. |
Constructors
BinarySuperToolTip
Initialises a new super tool tip component, with no tips set for any control yet.
Remarks
Give each control its tip with SetBinarySuperToolTipBodyText and the other
SetBinarySuperToolTip... methods.
Properties
OwnerDraw
Gets a value that is always true: the component always draws its tips itself.
- Value
- Always
true; a value set is ignored.
Methods
GetBinarySuperToolTipBackgroundDrawingGradientEndColor
Gets the colour a gradient background of control's tool tip ends with.
Parameters
control- The control whose tool tip it is.
nullis allowed and returns the default.
Returns
The end colour. The default is SystemColors.Info.
Remarks
Used while the background style is DrawingStyle.Gradient and no built-in scheme is chosen. With the default angle of 270 degrees the end colour is at the top of the tip.
See also
GetBinarySuperToolTipBackgroundDrawingGradientStartColor
Gets the colour a gradient background of control's tool tip starts from.
Parameters
control- The control whose tool tip it is.
nullis allowed and returns the default.
Returns
The start colour. The default is SystemColors.Info.
Remarks
Used while the background style is DrawingStyle.Gradient and no built-in scheme is chosen. With the default angle of 270 degrees the start colour is at the bottom of the tip.
See also
GetBinarySuperToolTipBackgroundDrawingSolidColor
Gets the background colour of control's tool tip when it is drawn solid.
Parameters
control- The control whose tool tip it is.
nullis allowed and returns the default.
Returns
The background colour. The default is SystemColors.Info.
Remarks
Used while the background style is DrawingStyle.Solid, which is the style of a tip with no style or scheme set.
See also
GetBinarySuperToolTipBackgroundDrawingStyle
Gets whether the background of control's tool tip is a gradient or a solid colour.
Parameters
control- The control whose tool tip it is.
nullis allowed and returns the default.
Returns
DrawingStyle.Gradient whenever a built-in colour scheme is chosen; otherwise the style set, or DrawingStyle.Solid when none has been set.
Remarks
A gradient runs from SetBinarySuperToolTipBackgroundDrawingGradientStartColor to
SetBinarySuperToolTipBackgroundDrawingGradientEndColor at
SetBinarySuperToolTipGradientDrawingOrientationAngle; a solid background is
SetBinarySuperToolTipBackgroundDrawingSolidColor.
Set it to DrawingStyle.Gradient before choosing a built-in colour scheme, which is
otherwise ignored. While a built-in scheme is in force the background is a gradient whatever is set
here.
See also
GetBinarySuperToolTipBodyImage
Gets the picture shown at the left of the body of control's tool tip.
Parameters
control- The control whose tool tip it is.
nullis allowed and returns the default.
Returns
The image, or null when there is none. The default is null.
Remarks
The tip grows to fit the picture at its own size, up to half the width and height of the
screen's working area. With SetBinarySuperToolTipUseCustomSizing on, a picture wider than
about half the tip is scaled down to fit.
The image must be a Bitmap. Each time the tip is drawn, the pixels of
SetBinarySuperToolTipBodyImageTransparencyColor are made see-through in the bitmap itself,
so pass a copy if the same bitmap is used elsewhere.
See also
GetBinarySuperToolTipBodyImageTransparencyColor
Gets the colour made see-through in the body picture of control's tool tip.
Parameters
control- The control whose tool tip it is.
nullis allowed and returns the default.
Returns
The colour. The default is Color.Transparent, which leaves the picture as it is.
See also
GetBinarySuperToolTipBodyText
Gets the main text of control's tool tip.
Parameters
control- The control whose tool tip it is.
Returns
The body text, or an empty string when the control has no tool tip or
control is null.
See also
GetBinarySuperToolTipBodyTextFont
Gets the font of the body text in control's tool tip.
Parameters
control- The control whose tool tip it is.
nullis allowed and returns the default.
Returns
The font set for the tip or, when none has been set, a new font in the family of MessageBoxFont at 10 points.
Remarks
The tip is sized to fit its text in these fonts each time it opens.
See also
GetBinarySuperToolTipBodyTextForeColor
Gets the colour of the body text in control's tool tip.
Parameters
control- The control whose tool tip it is.
nullis allowed and returns the default.
Returns
The text colour. The default is SystemColors.WindowText.
Remarks
Ignored while a built-in colour scheme is chosen with SetBinarySuperToolTipBuiltInColorScheme: the scheme draws it in SystemColors.WindowText.
See also
GetBinarySuperToolTipBorderColor
Gets the colour of the border round control's tool tip.
Parameters
control- The control whose tool tip it is.
nullis allowed and returns the default.
Returns
The border colour. The default is SystemColors.WindowText.
Remarks
Ignored while a built-in colour scheme is chosen with SetBinarySuperToolTipBuiltInColorScheme: the scheme draws it in SystemColors.WindowText.
See also
GetBinarySuperToolTipBorderColourAroundImage
Gets the colour of the frame round the body picture of control's tool tip.
Parameters
control- The control whose tool tip it is.
nullis allowed and returns the default.
Returns
The frame colour. The default is SystemColors.WindowText.
Remarks
The frame is drawn only while SetBinarySuperToolTipDrawBorderAroundBodyImage is on. Ignored while a built-in colour scheme is chosen with SetBinarySuperToolTipBuiltInColorScheme: the scheme draws it in SystemColors.WindowText.
See also
GetBinarySuperToolTipBuiltInColorScheme
Gets the built-in colour scheme control's tool tip is drawn in.
Parameters
control- The control whose tool tip it is.
nullis allowed and returns the default.
Returns
One of the ColorScheme values. The default is ColorScheme.Custom.
Remarks
A built-in scheme fills the background with a gradient from the scheme's colour to the window
colour, at SetBinarySuperToolTipGradientDrawingOrientationAngle, and draws all text, the
border and the lines in SystemColors.WindowText; the colours set for the tip one by one are
ignored while it is in force.
Set the background style to gradient first. While
GetBinarySuperToolTipBackgroundDrawingStyle is DrawingStyle.Solid – as it
is for a tip that has no scheme yet – a scheme set here is stored as ColorScheme.Custom
and has no effect.
See also
GetBinarySuperToolTipCustomSize
Gets the fixed size of control's tool tip.
Parameters
control- The control whose tool tip it is.
nullis allowed and returns the default.
Returns
The size, or Size.Empty when none has been set. The default is Size.Empty.
Remarks
The size is used as given and is not scaled for the display. With a fixed size, a body picture wider than about half the tip is scaled down to fit.
See also
GetBinarySuperToolTipDrawBorder
Gets whether a border is drawn round control's tool tip.
Parameters
control- The control whose tool tip it is.
nullis allowed and returns the default.
Returns
true when the border is drawn. The default is true.
See also
GetBinarySuperToolTipDrawBorderAroundBodyImage
Gets whether a frame is drawn round the body picture of control's tool tip.
Parameters
control- The control whose tool tip it is.
nullis allowed and returns the default.
Returns
true when the frame is drawn. The default is false.
See also
GetBinarySuperToolTipDrawTitleIcon
Gets whether the title icon of control's tool tip is shown.
Parameters
control- The control whose tool tip it is.
nullis allowed and returns the default.
Returns
true when the icon is shown. The default is false.
Remarks
The icon is shown only when the tip also has title text.
See also
GetBinarySuperToolTipGradientDrawingOrientationAngle
Gets the direction of the gradient background of control's tool tip.
Parameters
control- The control whose tool tip it is.
nullis allowed and returns the default.
Returns
The angle in degrees, measured clockwise from left-to-right. The default is 270, which runs from the bottom of the tip up to the top.
Remarks
Applies to both custom gradients and built-in colour schemes.
See also
GetBinarySuperToolTipTitleIcon
Gets the icon shown beside the title of control's tool tip.
Parameters
control- The control whose tool tip it is.
nullis allowed and returns the default.
Returns
The icon, or null when there is none. The default is null.
Remarks
Shown only while SetBinarySuperToolTipDrawTitleIcon is true and the tip has title text. It is drawn 20 logical pixels square, at the top left of the tip.
See also
GetBinarySuperToolTipTitleText
Gets the heading at the top of control's tool tip.
Parameters
control- The control whose tool tip it is.
nullis allowed and returns the default.
Returns
The title, or an empty string when there is none. The default is an empty string.
Remarks
The title is drawn in SetBinarySuperToolTipTitleTextFont and SetBinarySuperToolTipTitleTextForeColor. A tip with no title starts with its body.
See also
GetBinarySuperToolTipTitleTextFont
Gets the font of the title text in control's tool tip.
Parameters
control- The control whose tool tip it is.
nullis allowed and returns the default.
Returns
The font set for the tip or, when none has been set, a new font in the family of MessageBoxFont at 10 points.
Remarks
The tip is sized to fit its text in these fonts each time it opens. A bold font sets the title apart from the body.
See also
GetBinarySuperToolTipTitleTextForeColor
Gets the colour of the title text in control's tool tip.
Parameters
control- The control whose tool tip it is.
nullis allowed and returns the default.
Returns
The text colour. The default is SystemColors.WindowText.
Remarks
Ignored while a built-in colour scheme is chosen with SetBinarySuperToolTipBuiltInColorScheme: the scheme draws it in SystemColors.WindowText.
See also
GetBinarySuperToolTipUseCustomSizing
Gets whether control's tool tip has a fixed size rather than one fitted to its content.
Parameters
control- The control whose tool tip it is.
nullis allowed and returns the default.
Returns
true when the tip takes GetBinarySuperToolTipCustomSize. The default is false.
Remarks
Without a fixed size the tip is measured to fit its content, up to half the width and half the height of the primary screen's working area. Set a custom size as well when turning this on – a tip with no custom size has no size at all.
See also
SetBinarySuperToolTipBackgroundDrawingGradientEndColor
Sets the colour a gradient background of control's tool tip ends with.
Parameters
control- The control whose tool tip to change. Ignored when
null. value- The end colour.
Color.EmptyandColor.TransparentgiveSystemColors.Info.
Remarks
Used while the background style is DrawingStyle.Gradient and no built-in scheme is chosen. With the default angle of 270 degrees the end colour is at the top of the tip.
See also
SetBinarySuperToolTipBackgroundDrawingGradientStartColor
Sets the colour a gradient background of control's tool tip starts from.
Parameters
control- The control whose tool tip to change. Ignored when
null. value- The start colour.
Color.EmptyandColor.TransparentgiveSystemColors.Info.
Remarks
Used while the background style is DrawingStyle.Gradient and no built-in scheme is chosen. With the default angle of 270 degrees the start colour is at the bottom of the tip.
Example
tips.SetBinarySuperToolTipBackgroundDrawingStyle(exportButton, DrawingStyle.Gradient);
tips.SetBinarySuperToolTipBackgroundDrawingGradientStartColor(exportButton, Color.LightSteelBlue);
tips.SetBinarySuperToolTipBackgroundDrawingGradientEndColor(exportButton, Color.White);See also
SetBinarySuperToolTipBackgroundDrawingSolidColor
Sets the background colour of control's tool tip when it is drawn solid.
Parameters
control- The control whose tool tip to change. Ignored when
null. value- The background colour.
Color.EmptyandColor.TransparentgiveSystemColors.Info.
Remarks
Used while the background style is DrawingStyle.Solid, which is the style of a tip with no style or scheme set.
See also
SetBinarySuperToolTipBackgroundDrawingStyle
Sets whether the background of control's tool tip is a gradient or a solid colour.
Parameters
control- The control whose tool tip to change. Ignored when
null. valueDrawingStyle.GradientorDrawingStyle.Solid.
Remarks
A gradient runs from SetBinarySuperToolTipBackgroundDrawingGradientStartColor to
SetBinarySuperToolTipBackgroundDrawingGradientEndColor at
SetBinarySuperToolTipGradientDrawingOrientationAngle; a solid background is
SetBinarySuperToolTipBackgroundDrawingSolidColor.
Set it to DrawingStyle.Gradient before choosing a built-in colour scheme, which is
otherwise ignored. While a built-in scheme is in force the background is a gradient whatever is set
here.
See also
SetBinarySuperToolTipBodyImage
Sets a picture to show at the left of the body of control's tool tip, beside the body text – a preview, a chart or a screenshot of what the control does.
Parameters
control- The control whose tool tip to change. Ignored when
null. value- A
Bitmap, ornullto remove the picture.
Remarks
The tip grows to fit the picture at its own size, up to half the width and height of the
screen's working area. With SetBinarySuperToolTipUseCustomSizing on, a picture wider than
about half the tip is scaled down to fit.
The image must be a Bitmap. Each time the tip is drawn, the pixels of
SetBinarySuperToolTipBodyImageTransparencyColor are made see-through in the bitmap itself,
so pass a copy if the same bitmap is used elsewhere.
See also
SetBinarySuperToolTipBodyImageTransparencyColor
Sets the colour made see-through in the body picture of control's tool tip, so the tip's background shows through it.
Parameters
control- The control whose tool tip to change. Ignored when
null. value- The colour to remove, such as the magenta background of a bitmap.
Color.Emptyrestores the default.
See also
SetBinarySuperToolTipBodyText
Sets the main text of control's tool tip, and so turns the tip on for that control.
Parameters
control- The control to give a tool tip. Ignored when
null. value- The body text. It wraps to the width of the tip and may hold line breaks
(
NewLine). An empty string, or text that is only white space and line breaks, turns the tip off forcontrol.
Remarks
A control shows its tool tip only while it has body text: set the title, footer, icons and
colours as well, but always set this. Use this method rather than the inherited
ToolTip.SetToolTip, whose text this component does not draw.
When a handler is attached to HeaderDraw, BodyDraw or
FooterDraw at the time of the call, the text is replaced by the placeholder
"Being custom drawn.", on the expectation that the handlers draw the tip. Set the body text of
tips you want drawn normally before attaching such handlers.
Passing null throws a NullReferenceException; pass an empty
string to turn the tip off.
Example
tips.SetBinarySuperToolTipTitleText(archiveButton, "Archive orders");
tips.SetBinarySuperToolTipBodyText(archiveButton,
"Moves every order delivered more than 90 days ago to the archive." + Environment.NewLine +
"Archived orders can still be searched, but not edited.");See also
SetBinarySuperToolTipBodyTextFont
Sets the font of the body text in control's tool tip.
Parameters
control- The control whose tool tip to change. Ignored when
null. value- The font, or
nullfor the default: the message box font's family at 10 points.
Remarks
The tip is sized to fit its text in these fonts each time it opens.
See also
SetBinarySuperToolTipBodyTextForeColor
Sets the colour of the body text in control's tool tip.
Parameters
control- The control whose tool tip to change. Ignored when
null. value- The text colour.
Color.EmptyandColor.TransparentgiveSystemColors.WindowText.
Remarks
Ignored while a built-in colour scheme is chosen with SetBinarySuperToolTipBuiltInColorScheme: the scheme draws it in SystemColors.WindowText.
See also
SetBinarySuperToolTipBorderColor
Sets the colour of the border round control's tool tip.
Parameters
control- The control whose tool tip to change. Ignored when
null. value- The border colour.
Color.EmptyandColor.TransparentgiveSystemColors.WindowText.
Remarks
Ignored while a built-in colour scheme is chosen with SetBinarySuperToolTipBuiltInColorScheme: the scheme draws it in SystemColors.WindowText.
See also
SetBinarySuperToolTipBorderColourAroundImage
Sets the colour of the frame round the body picture of control's tool tip.
Parameters
control- The control whose tool tip to change. Ignored when
null. value- The frame colour.
Remarks
The frame is drawn only while SetBinarySuperToolTipDrawBorderAroundBodyImage is on. Ignored while a built-in colour scheme is chosen with SetBinarySuperToolTipBuiltInColorScheme: the scheme draws it in SystemColors.WindowText.
See also
SetBinarySuperToolTipBuiltInColorScheme
Sets a built-in colour scheme for control's tool tip, in place of individual colours.
Parameters
control- The control whose tool tip to change. Ignored when
null. value- A built-in scheme, or
ColorScheme.Customto use the colours set for the tip one by one.
Remarks
A built-in scheme fills the background with a gradient from the scheme's colour to the window
colour, at SetBinarySuperToolTipGradientDrawingOrientationAngle, and draws all text, the
border and the lines in SystemColors.WindowText; the colours set for the tip one by one are
ignored while it is in force.
Set the background style to gradient first. While
GetBinarySuperToolTipBackgroundDrawingStyle is DrawingStyle.Solid – as it
is for a tip that has no scheme yet – a scheme set here is stored as ColorScheme.Custom
and has no effect.
Example
tips.SetBinarySuperToolTipBackgroundDrawingStyle(saveButton, DrawingStyle.Gradient);
tips.SetBinarySuperToolTipBuiltInColorScheme(saveButton, ColorScheme.Blue);See also
SetBinarySuperToolTipCustomSize
Sets a fixed size for control's tool tip, used while SetBinarySuperToolTipUseCustomSizing is on.
Parameters
control- The control whose tool tip to change. Ignored when
null. value- The width and height of the tip in pixels.
Size.Emptyremoves the custom size.
Remarks
The size is used as given and is not scaled for the display. With a fixed size, a body picture wider than about half the tip is scaled down to fit.
See also
SetBinarySuperToolTipDrawBorder
Sets whether a border is drawn round control's tool tip.
Parameters
control- The control whose tool tip to change. Ignored when
null. valuetrueto draw a two-pixel border inSetBinarySuperToolTipBorderColor.
See also
SetBinarySuperToolTipDrawBorderAroundBodyImage
Sets whether a one-pixel frame is drawn round the body picture of control's tool tip.
Parameters
control- The control whose tool tip to change. Ignored when
null. valuetrueto frame the picture inSetBinarySuperToolTipBorderColourAroundImage.
See also
SetBinarySuperToolTipDrawTitleIcon
Sets whether the title icon of control's tool tip is shown.
Parameters
control- The control whose tool tip to change. Ignored when
null. valuetrueto show the icon set withSetBinarySuperToolTipTitleIcon.
Remarks
The icon is shown only when the tip also has title text.
See also
SetBinarySuperToolTipGradientDrawingOrientationAngle
Sets the direction of the gradient background of control's tool tip.
Parameters
control- The control whose tool tip to change. Ignored when
null. value- The angle in degrees, measured clockwise from left-to-right: 0 runs left to right, 90 top to bottom, 270 bottom to top.
Remarks
Applies to both custom gradients and built-in colour schemes.
See also
SetBinarySuperToolTipTitleIcon
Sets the icon shown beside the title of control's tool tip.
Parameters
control- The control whose tool tip to change. Ignored when
null. value- The icon, or
nullto remove it.
Remarks
Shown only while SetBinarySuperToolTipDrawTitleIcon is true and the tip has title text. It is drawn 20 logical pixels square, at the top left of the tip.
Example
tips.SetBinarySuperToolTipTitleIcon(deleteButton, SystemIcons.Warning);
tips.SetBinarySuperToolTipDrawTitleIcon(deleteButton, true);See also
SetBinarySuperToolTipTitleText
Sets the heading at the top of control's tool tip – usually the name of the command.
Parameters
control- The control whose tool tip to change. Ignored when
null. value- The title, on one line; text that does not fit ends in an ellipsis.
nullor an empty string removes the title.
Remarks
The title is drawn in SetBinarySuperToolTipTitleTextFont and SetBinarySuperToolTipTitleTextForeColor. A tip with no title starts with its body.
See also
SetBinarySuperToolTipTitleTextFont
Sets the font of the title text in control's tool tip.
Parameters
control- The control whose tool tip to change. Ignored when
null. value- The font, or
nullfor the default: the message box font's family at 10 points.
Remarks
The tip is sized to fit its text in these fonts each time it opens. A bold font sets the title apart from the body.
Example
tips.SetBinarySuperToolTipTitleTextFont(saveButton, new Font("Segoe UI", 10f, FontStyle.Bold));See also
SetBinarySuperToolTipTitleTextForeColor
Sets the colour of the title text in control's tool tip.
Parameters
control- The control whose tool tip to change. Ignored when
null. value- The text colour.
Color.EmptyandColor.TransparentgiveSystemColors.WindowText.
Remarks
Ignored while a built-in colour scheme is chosen with SetBinarySuperToolTipBuiltInColorScheme: the scheme draws it in SystemColors.WindowText.
See also
SetBinarySuperToolTipUseCustomSizing
Sets whether control's tool tip has a fixed size rather than one fitted to its content.
Parameters
control- The control whose tool tip to change. Ignored when
null. valuetrueto give the tip the size set withSetBinarySuperToolTipCustomSize;falseto fit it to the title, body, footer, icons and picture each time it opens.
Remarks
Without a fixed size the tip is measured to fit its content, up to half the width and half the height of the primary screen's working area. Set a custom size as well when turning this on – a tip with no custom size has no size at all.
Example
tips.SetBinarySuperToolTipCustomSize(chartButton, new Size(320, 200));
tips.SetBinarySuperToolTipUseCustomSizing(chartButton, true);See also
Events
AboutToPopup
Occurs just before a tool tip opens, so it can be cancelled or brought up to date.
Remarks
Raised for every control the component gives a tip. Set
BinarySuperToolTipPopupEventArgs.CancelNow to keep the tip closed this time, or change
the tip's title, footer and appearance for
BinarySuperToolTipPopupEventArgs.AssociatedControl before it is measured and drawn.
Example
tips.AboutToPopup += (sender, e) =>
{
if (e.AssociatedControl == stockLabel)
{
tips.SetBinarySuperToolTipFooterText(stockLabel,
"Stock checked at " + DateTime.Now.ToShortTimeString());
}
// No tips while the order is being saved.
e.CancelNow = isSaving;
};BodyDraw
Occurs before the body of a tool tip is drawn, so it can be drawn by your own code instead.
Remarks
Raised every time any of the component's tips is drawn. Draw with
BinarySuperToolTipDrawingEventArgs.Graphics, check
BinarySuperToolTipDrawingEventArgs.AssociatedControl to see whose tip it is, and set
BinarySuperToolTipDrawingEventArgs.Handled to true for the tips you
have drawn – leave it false and the component draws the body as usual.
The rectangle offered is the middle three fifths of the tip, below the title area.
tips.BodyDraw += (sender, e) =>
{
if (e.AssociatedControl != salesChartButton)
{
return;
}
using (Brush bar = new SolidBrush(Color.SteelBlue))
{
float x = e.DrawingRectangle.X + 12;
foreach (float share in new[] { 0.4f, 0.7f, 0.55f, 0.9f })
{
float height = (e.DrawingRectangle.Height - 12) * share;
e.Graphics.FillRectangle(bar, x, e.DrawingRectangle.Bottom - 6 - height, 18, height);
x += 26;
}
}
e.Handled = true;
};While any of the three drawing events has a handler, SetBinarySuperToolTipBodyText
stores a placeholder instead of the text it is given, so attach handlers after setting body texts.
Example
tips.BodyDraw += (sender, e) =>
{
if (e.AssociatedControl != salesChartButton)
{
return;
}
using (Brush bar = new SolidBrush(Color.SteelBlue))
{
float x = e.DrawingRectangle.X + 12;
foreach (float share in new[] { 0.4f, 0.7f, 0.55f, 0.9f })
{
float height = (e.DrawingRectangle.Height - 12) * share;
e.Graphics.FillRectangle(bar, x, e.DrawingRectangle.Bottom - 6 - height, 18, height);
x += 26;
}
}
e.Handled = true;
};HeaderDraw
Occurs before the title area of a tool tip is drawn, so it can be drawn by your own code instead.
Remarks
Raised every time any of the component's tips is drawn. Draw with
BinarySuperToolTipDrawingEventArgs.Graphics, check
BinarySuperToolTipDrawingEventArgs.AssociatedControl to see whose tip it is, and set
BinarySuperToolTipDrawingEventArgs.Handled to true for the tips you
have drawn – leave it false and the component draws the title area as usual.
The rectangle offered is the top fifth of the tip.
While any of the three drawing events has a handler, SetBinarySuperToolTipBodyText
stores a placeholder instead of the text it is given, so attach handlers after setting body texts.