Version

Specify a Different Appearance for a Tool on the Toolbar and Menu

You can have the same tool displayed on a toolbar and on a menu at the same time, and give each instance of the tool a different appearance. You do this through the AppearanceOnToolBar , and AppearanceOnMenu properties. The HotTrackAppearanceOnToolBar , HotTrackAppearanceOnMenu , PressedAppearanceOnToolBar and PressedAppearanceOnmenu properties also affect the difference between the toolbar and menu appearance of a tool instance.

These properties are contained in the ToolAppearance objects returned by the AppearancesLarge and AppearancesSmall properties. These properties can be found in both the SharedProps and InstanceProps objects of the tool. The ToolAppearance returned by AppearancesSmall contains the appearance settings for use for the tool when small images are being rendered; AppearancesLarge is used when you choose the options Large Icons on Menu or Large Icon on ToolBar.

At Design Time

  1. In the Customize editor select a Button tool that you have created.

  2. In the SharedProps object for the Button tool, select AppearanceOnMenu and AppearanceOnToolBar and set some properties in each one. (If you want, you can also set properties for the HotTrackAppearanceOnMenu, HotTrackAppearanceOnToolBar, PressedAppearanceOnMenu and PressedAppearanceOnToolBar.)

  3. Add the button tool to a toolbar and also add it to a PopUp menu tool’s drop down.

  4. Run the project and you will see the visual difference between the two instances of the tools.

At Run Time

In Visual Basic:

Imports Infragistics.Win.UltraWinToolbars
Imports Infragistics.Win
...
Private Sub _
  Specify_a_Different_Appearance_for_a_Tool_on_the_Toolbar_and_Menu_Load(_
  ByVal sender As System.Object, _
  ByVal e As System.EventArgs) Handles MyBase.Load
	Me.UltraToolbarsManager1.Tools("NewFile").SharedProps. _
	  DisplayStyle = ToolDisplayStyle.TextOnlyAlways
	Me.UltraToolbarsManager1.Tools("NewFile").SharedProps.AppearancesSmall. _
	  AppearanceOnMenu.FontData.Bold = DefaultableBoolean.True
	Me.UltraToolbarsManager1.Tools("NewFile").SharedProps.AppearancesSmall. _
	  AppearanceOnToolbar.FontData.Bold = DefaultableBoolean.False
	Me.UltraToolbarsManager1.Tools("NewFile").SharedProps.AppearancesSmall. _
	  HotTrackAppearanceOnMenu.ForeColor = Color.AntiqueWhite
	Me.UltraToolbarsManager1.Tools("NewFile").SharedProps.AppearancesSmall. _
	  HotTrackAppearanceOnToolbar.ForeColor = Color.FromArgb(100, 200, 175)
End Sub

In C#:

using Infragistics.Win.UltraWinToolbars;
using Infragistics.Win;
...
private void
  Specify_a_Different_Appearance_for_a_Tool_on_the_Toolbar_and_Menu_Load(
  object sender, EventArgs e)
{
	this.ultraToolbarsManager1.Tools["NewFile"].SharedProps.
	  DisplayStyle = ToolDisplayStyle.TextOnlyAlways;
	this.ultraToolbarsManager1.Tools["NewFile"].SharedProps.
	  AppearancesSmall.AppearanceOnMenu.FontData.Bold = DefaultableBoolean.True;
	this.ultraToolbarsManager1.Tools["NewFile"].SharedProps.
	  AppearancesSmall.AppearanceOnToolbar.FontData.Bold = DefaultableBoolean.False;
	this.ultraToolbarsManager1.Tools["NewFile"].SharedProps.
	  AppearancesSmall.HotTrackAppearanceOnMenu.ForeColor = Color.AntiqueWhite;
	this.ultraToolbarsManager1.Tools["NewFile"].SharedProps.
	  AppearancesSmall.HotTrackAppearanceOnToolbar.ForeColor =
	  Color.FromArgb(100, 200, 175);
}