Class RichToolTip
Allows to show a tool tip with more customizations than a standard tooltip. Additionally to the tooltip message RichToolTip allows to specify title, image, tip kind and some other options.
public class RichToolTip : DisposableObject, IBaseObject, IDisposableObject, IDisposable
- Inheritance
-
RichToolTip
- Implements
Examples
Also, a RichToolTip can be created from code:
public void ShowToolTip_Click(object? sender, EventArgs e)
{
RichToolTip.Show(
"Title",
"Some text",
label1,
RichToolTipKind.Top,
MessageBoxIcon.Exclamation);
}
public void HideToolTip_Click(object? sender, EventArgs e)
{
RichToolTip.Default = null;
}
public void ShowToolTip2_Click(object? sender, EventArgs e)
{
var tooltip = new RichToolTip("Another Title", "Some text");
tooltip.SetIcon(MessageBoxIcon.Error);
tooltip.SetTipKind(RichToolTipKind.None);
tooltip.SetBackgroundColor(Color.Red, null);
tooltip.SetForegroundColor(Color.White);
tooltip.SetTitleFont(Control.DefaultFont.Larger().AsBold);
tooltip.SetTitleForegroundColor(Color.White);
// This call hides previous tooltip after call to RichToolTip.Show
// and assigns new tooltip
RichToolTip.Default = tooltip;
tooltip.Show(label1);
}
Remarks
Example of how a RichToolTip can look:
Constructors
- RichToolTip(string?, string?)
Initializes a new instance of the RichToolTip class.
Properties
- Default
Gets or sets default RichToolTip.
- DefaultBackgroundColor
Gets or sets default background color of the tooltip.
- DefaultBackgroundColorEnd
Gets or sets default background end color of the tooltip.
- DefaultForegroundColor
Gets or sets default foreground color of the tooltip.
- DefaultIgnoreImages
Gets or sets default value for the IgnoreImages property.
- DefaultTitleForegroundColor
Gets or sets default foreground color of the tooltip.
- Handler
Gets IRichToolTipHandler provider used to work with tooltip.
- IgnoreImages
Gets or sets whether to ignore image in tooltip, even if it is specified.
- UseGeneric
Gets or sets whether to use generic or native control as a RichToolTip.
Methods
- DisposeManaged()
Override to dispose managed resources. Here we dispose all used object references.
- SetBackgroundColor(Color?, Color?)
Sets the background color: if two colors are specified, the background is drawn using a gradient from top to bottom, otherwise a single solid color is used.
- SetForegroundColor(Color?)
Sets foreground color of the tooltip message.
- SetIcon(ImageSet?)
Sets the small icon to show in the tooltip.
- SetIcon(MessageBoxIcon)
Sets the standard icon to show in the tooltip.
- SetTimeout(uint, uint)
Sets timeout after which the tooltip should disappear, in milliseconds. Optionally specify a show delay.
- SetTipKind(RichToolTipKind)
Chooses the tip kind, possibly none. By default the tip is positioned automatically, as if Auto was used.
- SetTitleFont(Font?)
Sets the title text font.
- SetTitleForegroundColor(Color?)
Sets foreground color of the tooltip title.
- Show(Control, RectI?)
Shows the tooltip for the given control and optionally a specified area.
- Show(string?, string?, Control, RichToolTipKind?, MessageBoxIcon?)
Shows tooltip on the screen.
- ShowSimple(string, Control, bool)
Shows simple tooltip on the screen.