HypernovaDesktop Components · docs
Binarymission
WinForms › Tool Tip › BinaryPointTip

BinaryPointTip

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WinForms.Controls.Popups

A tool tip you show yourself, at any point on the screen – to point out a field that needs attention, confirm an action next to where it happened, or guide a user through a form – with a title, an icon, text and the same rectangle or balloon look as BinaryToolTip.

public sealed partial class BinaryPointTip : Component

Inherits from / implements: Component

Remarks

Unlike BinaryToolTip, a point tip is not tied to a control or to the mouse: call Show with the title, text, screen point and how long to show it, or ShowForEver to keep it up until you call Hide. It also closes when the pointer moves over it.

The tip's body appears a mouse-pointer's height below the point; a BinaryToolTipStyle.BalloonType tip points back up at it. A tip that would run off the screen is moved above the point or to the left. Colours, fonts, shadow and wrapping are set on the component: BackColor, BorderColor, TitleForeColor, TextForeColor, ToolTipTextFont, ShadowOffset, CustomWidth.

Examples

Point at an invalid e-mail address when the user tries to save.

using System;
using System.Drawing;
using System.Windows.Forms;
using Binarymission.WinForms.Controls.Popups;

private readonly BinaryPointTip _hint = new BinaryPointTip
{
    BackColor = Color.MistyRose,
    BorderColor = Color.Firebrick,
    TitleForeColor = Color.Firebrick,
    CustomWidth = 220
};

private void OnSaveClick(object sender, EventArgs e)
{
    if (!emailBox.Text.Contains("@"))
    {
        // The middle of the box's bottom edge, in screen coordinates.
        Point anchor = emailBox.PointToScreen(new Point(emailBox.Width / 2, emailBox.Height));

        _hint.Show("Check the e-mail address",
                   "An e-mail address needs an @, as in orders@example.com.",
                   anchor, 4000, SystemIcons.Warning.ToBitmap(), BinaryToolTipStyle.BalloonType);
        emailBox.Focus();
    }
}

See also

Members at a glance

Constructors
BinaryPointTipInitialises a new point tip with a standard rectangular look in light yellow with a brown outline.
BinaryPointTipInitialises a new point tip, as the Windows Forms designer creates it.
Properties
AutomaticMultiLineSupportGets or sets whether long text wraps at CustomWidth rather than running on in one line.
BackColorGets or sets the colour that fills the tip.
BalloonEdgeCurveFactorGets or sets how rounded the corners of a balloon tip are.
BorderColorGets or sets the colour of the line round the tip.
CustomWidthGets or sets the width at which the tip's text wraps onto a new line.
ImageGets or sets a picture to keep with the component.
PointTipTextGets or sets the text of the tip, and updates the tip on screen if it is showing.
ShadowColorGets or sets the colour the tip's drop shadow is drawn in.
ShadowOffsetGets or sets how far the tip's drop shadow falls to the right and below the tip.
ShowDelayGets or sets a display time in milliseconds.
TextForeColorGets or sets the colour of the tip's main text.
TitleForeColorGets or sets the colour of the tip's title.
TitleWillBeBoldGets or sets whether the tip's title is bold.
TitleWillBeUnderlinedGets or sets whether the tip's title is underlined.
ToolTipHideDelayGets or sets a display time in milliseconds, as on BinaryToolTip.
ToolTipHoverDelayGets or sets a hover delay in milliseconds, as on BinaryToolTip.
ToolTipReshowDelayGets or sets a reshow delay in milliseconds, as on BinaryToolTip.
ToolTipTextFontGets or sets the font of the tip's main text.
ToolTipTipStyleGets or sets the shape of the tip.
Methods
DisposeCloses any open tip and releases the resources the component holds.
HideCloses the tip, whether it was shown with Show or ShowForEver.
ShowShows the tip at a point on the screen for a set time.
ShowForEverShows the tip at a point on the screen until Hide is called.

Constructors

BinaryPointTip

public BinaryPointTip()

Initialises a new point tip with a standard rectangular look in light yellow with a brown outline.

BinaryPointTip

public BinaryPointTip(IContainer ic) : this()

Initialises a new point tip, as the Windows Forms designer creates it.

Parameters
ic
The form's component container.

Properties

AutomaticMultiLineSupport

public bool AutomaticMultiLineSupport

Gets or sets whether long text wraps at CustomWidth rather than running on in one line.

Value
true to wrap the text at CustomWidth. The default is true.
Remarks

With wrapping off, the tip is as wide as the longest line, and lines break only where the text has line breaks.

BackColor

public Color BackColor

Gets or sets the colour that fills the tip.

Value
The fill colour. The default is Color.LightYellow.
See also

BalloonEdgeCurveFactor

public int BalloonEdgeCurveFactor

Gets or sets how rounded the corners of a balloon tip are.

Value
The size of each rounded corner as a percentage of the balloon's width and height. The default is 15.
Designer category
Appearance"), Description("Gets or sets the Edge curve factor when the style is Balloon style!
Remarks

Used only by the BinaryToolTipStyle.BalloonType style; a standard tip has square corners. Larger values give a rounder, more pill-like balloon. Being a percentage, it looks the same at every display scale.

BorderColor

public Color BorderColor

Gets or sets the colour of the line round the tip.

Value
The outline colour. The default is Color.Brown.
Remarks

A balloon tip's outline, including its pointer, is two pixels wide; a standard tip's is one.

CustomWidth

public int CustomWidth

Gets or sets the width at which the tip's text wraps onto a new line.

Value
The wrap width in logical pixels. The default is 100; values below 100 are raised to 100.
Remarks

Used only while AutomaticMultiLineSupport is on. Line breaks in the text always start a new line.

Example
tip.AutomaticMultiLineSupport = true;
tip.CustomWidth = 260;   // wrap long hints at about 260 logical pixels

Image

public Image Image

Gets or sets a picture to keep with the component.

Value
A copy of the picture with the colour of its top-left pixel made see-through, or null. The default is null.
Remarks

Not used by Show or ShowForEver, which draw the picture passed to them; pass this property's value there to use it.

Example
hint.Image = Properties.Resources.Lightbulb16;
hint.Show("Tip", "Double-click a row to open the order.", anchor, 5000, hint.Image, BinaryToolTipStyle.BalloonType);

PointTipText

public string PointTipText

Gets or sets the text of the tip, and updates the tip on screen if it is showing.

Value
The text last shown or set. The default is null.
Remarks

Setting it while the tip is up re-draws the tip with the new text at the same point – handy for a progress or countdown message. While no tip is showing, the next call to Show or ShowForEver replaces it with the text passed there.

ShadowColor

public Color ShadowColor

Gets or sets the colour the tip's drop shadow is drawn in.

Value
The shadow colour. The default is Color.Black.
Designer category
Appearance"), Description("Gets or sets the colour the tip's drop shadow is drawn in"), DefaultValue(typeof(Color), "Black
Remarks

The shadow is drawn partly transparent and faded at its edge, so black darkens whatever is behind the tip on any theme. A light colour shows only over a background darker than itself.

See also

ShadowOffset

public Point ShadowOffset

Gets or sets how far the tip's drop shadow falls to the right and below the tip.

Value
The horizontal and vertical offset in logical pixels. The default is (7, 7).
Designer category
Appearance"), Description("Gets or sets the dropshadow position
Remarks

A larger offset makes the tip seem to float higher. The shadow's soft edge widens with the offset, between 2 and 24 pixels. Negative values cast the shadow up or to the left.

See also

ShowDelay

public float ShowDelay

Gets or sets a display time in milliseconds.

Value
The default is 5000.
Remarks

Has no effect: Show takes the display time as an argument.

TextForeColor

public Color TextForeColor

Gets or sets the colour of the tip's main text.

Value
The text colour. The default is SystemColors.WindowText.
See also

TitleForeColor

public Color TitleForeColor

Gets or sets the colour of the tip's title.

Value
The title colour. The default is SystemColors.WindowText.
See also

TitleWillBeBold

public bool TitleWillBeBold

Gets or sets whether the tip's title is bold.

Value
true for a bold title. The default is true.
Remarks

The title is drawn in the family of the system message box font at 8 points.

See also

TitleWillBeUnderlined

public bool TitleWillBeUnderlined

Gets or sets whether the tip's title is underlined.

Value
true to underline the title. The default is false.
Remarks

The title is drawn in the family of the system message box font at 8 points.

See also

ToolTipHideDelay

public int ToolTipHideDelay

Gets or sets a display time in milliseconds, as on BinaryToolTip.

Value
The default is 5000.
Designer category
Behavior"), Description("Gets or sets the delay, in milliseconds, before when the tooltip will appear while the mouse is stationary over the target control"), DefaultValue(5000
Remarks

Has no effect on a point tip: pass the display time to Show instead.

ToolTipHoverDelay

public int ToolTipHoverDelay

Gets or sets a hover delay in milliseconds, as on BinaryToolTip.

Value
The default is 500.
Designer category
Behavior"), Description("Gets or sets the delay, in milliseconds, before when the tooltip will appear while the mouse is stationary over the target control"), DefaultValue(500
Remarks

Has no effect on a point tip, which is shown and hidden only by Show, ShowForEver and Hide. It is kept so that the same settings can be used on a BinaryToolTip.

ToolTipReshowDelay

public int ToolTipReshowDelay

Gets or sets a reshow delay in milliseconds, as on BinaryToolTip.

Value
The default is 100.
Designer category
Behavior"), Description("Gets or sets the time, in milliseconds, when to reshow the tooltip as the mouse moves to another target control"), DefaultValue(100
Remarks

Has no effect on a point tip, which is shown and hidden only by Show, ShowForEver and Hide. It is kept so that the same settings can be used on a BinaryToolTip.

ToolTipTextFont

public Font ToolTipTextFont

Gets or sets the font of the tip's main text.

Value
The font. When none has been set, the family of the system message box font at 8 points.
Designer category
Appearance"), Description("Gets or sets the font used to display the tooltip's text!"), Editor("FontEditor", typeof(System.Drawing.Design.UITypeEditor)
Remarks

The tip is sized to fit its text in this font each time it is shown. The title's font is set separately, with TitleWillBeBold and TitleWillBeUnderlined.

ToolTipTipStyle

public BinaryToolTipStyle ToolTipTipStyle

Gets or sets the shape of the tip.

Value
BinaryToolTipStyle.Standard for a rectangle, or BinaryToolTipStyle.BalloonType for a rounded balloon with a pointer. The default is BinaryToolTipStyle.Standard.
Designer category
Appearance"), Description("Gets or sets the style used to display the tooltip."), DefaultValue(BinaryToolTipStyle.Standard
Remarks

Show and ShowForEver set it to the style they are given.

Methods

Dispose

protected override void Dispose(bool disposing)

Closes any open tip and releases the resources the component holds.

Parameters
disposing
true when called from Dispose(); false when called from a finaliser.

Hide

public void Hide()

Closes the tip, whether it was shown with Show or ShowForEver.

Remarks

Does nothing when no tip is showing.

Show

public void Show(string title, string tiptext, Point pnt, float Delay, Image img, BinaryToolTipStyle style)

Shows the tip at a point on the screen for a set time.

Parameters
title
The title, drawn above the text (bold unless TitleWillBeBold is off); null or an empty string for none.
tiptext
The text of the tip. It wraps at CustomWidth while AutomaticMultiLineSupport is on.
pnt
The point to show the tip at, in screen coordinates – use Control.PointToScreen to convert from a control's coordinates.
Delay
How long the tip stays up, in milliseconds.
img
A small picture shown beside the title, ideally 16 by 16 pixels, or null. It must be a Bitmap, and is drawn as it is, without the transparency that Image applies.
style
The shape: a rectangle, or a balloon pointing at pnt. It also becomes ToolTipTipStyle.
Remarks

A tip already showing is replaced. The tip also closes when the pointer moves over it, or when Hide is called.

See also

ShowForEver

public void ShowForEver(string title, string tiptext, Point pnt, Image img, BinaryToolTipStyle theTipStyle)

Shows the tip at a point on the screen until Hide is called.

Parameters
title
The title, drawn above the text (bold unless TitleWillBeBold is off); null or an empty string for none.
tiptext
The text of the tip.
pnt
The point to show the tip at, in screen coordinates.
img
A small picture shown beside the title, or null. It must be a Bitmap.
theTipStyle
The shape: a rectangle, or a balloon pointing at pnt. It also becomes ToolTipTipStyle.
Remarks

Use it for guidance that must stay until the user acts, such as the next step of a walkthrough. The tip still closes if the pointer moves over it.

Example
Point anchor = importButton.PointToScreen(new Point(importButton.Width / 2, importButton.Height));
hint.ShowForEver("Step 2 of 3", "Click Import to load the price list.", anchor, null, BinaryToolTipStyle.BalloonType);

importButton.Click += (s, e) => hint.Hide();