SuperToolTip.Items Property
Gets the collection of items which constitute the SuperToolTip object.
Namespace: DevExpress.Utils
Assembly: DevExpress.Utils.v18.2.dll
Declaration
Property Value
Type | Description |
---|---|
DevExpress.Utils.ToolTipItemCollection | A DevExpress.Utils.ToolTipItemCollection which contains items displayed by the SuperToolTip object. |
Remarks
A SuperToolTip object can contain multiple tooltip items displayed one under another. Each tooltip item defines the text painted in a specific style and can also display an image. The Items property specifies the collection of tooltip items. You can use this property to access, add or remove specific items.
A regular tooltip item, which can display text and image, is represented by the ToolTipItem class. Its descendant, the DevExpress.Utils.ToolTipTitleItem class, can be used to represent a tooltip’s title and header. The difference between the ToolTipItem and ToolTipTitleItem objects is in the default appearance settings used to paint an item’s text. If you need to customize the appearance of a specific tooltip item, use the item’s Appearance property.
To add a separator line to the SuperToolTip, add a DevExpress.Utils.ToolTipSeparatorItem object to the Items collection.
Example
The following example demonstrates a way of creating a SuperToolTip object with two tooltip items. The first item will display the “Edit Popup Menu” string. The second item will contain an image and the “Show the Edit popup menu” text.
The example shows two ways of adding tooltip items to a SuperToolTip object.
- explicitly adding items to the
SuperToolTip.Items
collection; - using the SuperToolTip.Setup method.
using DevExpress.Utils;
// The component used to load images from a form's resources.
System.ComponentModel.ComponentResourceManager resources =
new System.ComponentModel.ComponentResourceManager(typeof(Form1));
// The image to display within a SuperTooltip.
Image resImage = ((System.Drawing.Image)(resources.GetObject("resource.Image1")));
// Method 1
SuperToolTip sTooltip1 = new SuperToolTip();
// Create a tooltip item that represents a header.
ToolTipTitleItem titleItem1 = new ToolTipTitleItem();
titleItem1.Text = "Edit Popup Menu";
// Create a tooltip item that represents the SuperTooltip's contents.
ToolTipItem item1 = new ToolTipItem();
item1.Image = resImage;
item1.Text = "Show the Edit popup menu";
// Add the tooltip items to the SuperTooltip.
sTooltip1.Items.Add(titleItem1);
sTooltip1.Items.Add(item1);
// Assign the created SuperToolTip to a BarItem.
barItem1.SuperTip = sTooltip1;
// Method 2
SuperToolTip sTooltip2 = new SuperToolTip();
// Create an object to initialize the SuperToolTip.
SuperToolTipSetupArgs args = new SuperToolTipSetupArgs();
args.Title.Text = "Edit Popup Menu";
args.Contents.Text = "Show the Edit popup menu";
args.Contents.Image = resImage;
sTooltip2.Setup(args);
// Assign the created SuperToolTip to a BarItem.
barItem2.SuperTip = sTooltip2;