ToolTipItem Class
A regular tooltip item in a SuperToolTip that displays text and/or an image.
Namespace: DevExpress.Utils
Assembly: DevExpress.Utils.v18.1.dll
Declaration
[TypeConverter(typeof(ToolTipTypeConverter))]
public class ToolTipItem :
BaseToolTipItem,
ISerializable,
IDisposable
Remarks
Along with the ToolTipTitleItem and ToolTipSeparatorItems, the ToolTipItem can be used to construct a SuperToolTip object. A ToolTipItem object is a regular item, while the ToolTipTitleItem and ToolTipSeparatorItem items represent a title item and a separator, respectively.
A ToolTipItem displays text and/or graphic information. To display text information, use the ToolTipItem.Text property. It is possible to use HTML tags to format the text. To enable HTML formatting, use the ToolTipItem.AllowHtmlText property.
To display graphic information within a ToolTipItem, you can use the following properties:
- ToolTipItem.Icon - Allows you to display a System.Drawing.Icon object.
- ToolTipItem.Image - Allows you to display a System.Drawing.Image object.
- ToolTipItem.ImageIndex - Allows you to display a System.Drawing.Image object from the ToolTipItem.Images collection.
The ToolTipItem class provides properties for content formatting:
- text font (ToolTipItem.Font),
- image alignment (ToolTipItem.ImageAlign),
- left indentation (ToolTipItem.LeftIndent),
- spacing between the image and text (ToolTipItem.ImageToTextDistance).
Example
The following example demonstrates how to create a SuperToolTip object with a ToolTipItem object inside and assign it to a button.
using DevExpress.Utils;
//...
//Create a new instance of the SuperToolTip object.
SuperToolTip sTooltip1 = new SuperToolTip();
//Create a new instance of the ToolTipItem object.
ToolTipItem item1 = new ToolTipItem();
//Specify the properties.
item1.Image = System.Drawing.Image.FromFile("d:\\image.bmp");
item1.Text = "This is <i>the text</i> in <b>the tooltip</b>";
item1.ImageToTextDistance = 50;
item1.AllowHtmlText = DefaultBoolean.True;
// Add the tooltip item to the SuperTooltip.
sTooltip1.Items.Add(item1);
// Assign the created SuperToolTip to a Button.
simpleButton1.SuperTip = sTooltip1;
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the ToolTipItem class.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.