下面的示例展示了如何创建一个有两个工具提示项的 SuperToolTip 对象。 其中第一个工具提示项将显示 "Edit Popup Menu" 字符串; 第二个工具提示项将包含一幅图片和 "Show the Edit popup menu" 文本:

本示例展示了把工具提示项添加到 SuperToolTip 对象的两种方式:

C#CopyCode image复制代码
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);

// 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);

Visual BasicCopyCode image复制代码
Imports DevExpress.Utils

' The component used to load images from a form's resources.
Dim resources As System.ComponentModel.ComponentResourceManager = _
  New System.ComponentModel.ComponentResourceManager(GetType(Form1))
' The image to display within a SuperTooltip.
Dim resImage As Image = CType(resources.GetObject("resource.Image1"), System.Drawing.Image)

' Method 1
Dim sTooltip1 As SuperToolTip = New SuperToolTip
' Create a tooltip item that represents a header.
Dim titleItem1 As ToolTipTitleItem = New ToolTipTitleItem
titleItem1.Text = "Edit Popup Menu"
' Create a tooltip item that represents the SuperTooltip's contents.
Dim item1 As ToolTipItem = 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)

' Method 2
Dim sTooltip2 As SuperToolTip = New SuperToolTip
' Create an object to initialize the SuperToolTip.
Dim args As SuperToolTipSetupArgs = New SuperToolTipSetupArgs
args.Title.Text = "Edit Popup Menu"
args.Contents.Text = "Show the Edit popup menu"
args.Contents.Image = resImage
sTooltip2.Setup(args)