[]
A ToolTip is used to display text when the mouse hovers over the control. The C1MainMenu class provides the ShowToolTips property to indicate whether the menu item can show the tooltip text when the mouse cursor hovers over it. By default, this property is false.
When you set the ShowToolTips property to true, the value of the Text property of the menu item is displayed as the tooltip. For example, if we have a menu item in the main menu with text value as File, then the tooltip will appear as follows:
You can also set a custom text as the tooltip of each menu item. For doing so, set the ShowTextAsToolTip property to False and then set the custom text using the ToolTipText property. For instance, if we have a menu item with text value as File and the ToolTip Text set as 'View File', then the tooltip will appear as shown below.
To display the tooltip text, use the following code.
C1CommandMenu mmenu = ch.CreateCommand(typeof(C1CommandMenu)) as C1CommandMenu;
mmenu.Text = "File";
mmenu.ShowTextAsToolTip = false;
mmenu.ToolTipText = "View file";
While you can display plain text tooltips for the MainMenu control, it is also possible to display tooltips with rich HTML text, and use different fonts. To display such tooltips, use SuperTooltip property of the C1MainMenu class, which gets an external SuperToolTip control for the MainMenu.
The following image depicts a supertooltip that appears on hovering over the File menu.
To configure the SuperTooltip, follow the steps below:
Install the C1.Win.SuperTooltip package.
Drag and drop the SuperTooltip component on the form.
In the Properties window, select the SuperTooltip component from the dropdown menu of the SuperTooltip property of the MainMenu control.
In the Properties window, click the ellipsis button next to the Tooltip on c1SuperTooltip1 property of the MainMenu to open the C1SuperTooltip Editor.
Select the Html tab. Enter the following HTML code in the Html text box.
<tr><td><b>View file menu</b><td></tr>
A preview of the SuperTooltip appears in the Preview pane.
Select the Properties tab, set the BackgroundGradient, Font and Size properties for the supertooltip and click OK to close the editor.
Use the SetToolTip (System.Windows.Forms.Control control, string text) method of the C1SuperTooltip class to associate the tooltip HTML text with the specified control, which is MainMenu control in our case.
c1SuperTooltip1.SetToolTip(c1MainMenu1, "<tr><td><b>View file menu</b><td></tr>");
type=note
Note: The SetToolTip property only works with controls and ToolStripItems and not for components, which means that it cannot be used for menu items. In such a case, you can just set the SuperToolTip and ToolTipText properties for the menu item.
Set the BackgroundGradient and Font properties for SuperTooltip.
c1SuperTooltip1.BackgroundGradient = BackgroundGradient.Vista;
c1SuperTooltip1.Font = new Font("Arial", 9);
For more information on how to use the ToolTips, see Displaying ToolTips for Menus and Toolbars.