Version

MenuSettings Class

Settings that are specific to menus.
Syntax
'Declaration
 
Public Class MenuSettings 
   Inherits SettingsBase
public class MenuSettings : SettingsBase 
Example
The following code demonstrates how the MenuSettings object can be used to establish settings for that will affect ALL menus. It also shows how those settings can be overridden for a specific menu.

Imports System.Diagnostics
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinToolbars

	Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

		' ----------------------------------------------------------------------------
		' Create some PopupMenuTools.
		Dim popupMenu3 As New PopupMenuTool("PopupMenu3")
		Dim popupMenu4 As New PopupMenuTool("PopupMenu4")
		Dim popupMenu5 As New PopupMenuTool("PopupMenu5")
		Dim popupMenu6 As New PopupMenuTool("PopupMenu6")

		' Always add new tools to the UltraToolbarManager's root tools collection
		' before adding them to menus or toolbars.
		Me.UltraToolbarsManager1.Tools.AddRange(New ToolBase() {popupMenu3, popupMenu4, popupMenu5, popupMenu6})


		' Set some properties on the Popup menus
		popupMenu3.SharedProps.Caption = "Popup Menu 3"
		popupMenu4.SharedProps.Caption = "Popup Menu 4"
		popupMenu5.SharedProps.Caption = "Popup Menu 5"
		popupMenu6.SharedProps.Caption = "Popup Menu 6"


		' ----------------------------------------------------------------------------
		' Create a some tools and add them to the menus.
		Dim textTool As New TextBoxTool("TextTool")
		Dim comboTool As New ComboBoxTool("ComboTool")
		Dim colorTool As New PopupColorPickerTool("ColorTool")
		Dim fontTool As New FontListTool("FontTool")

		' Set some properties on the tools.
		textTool.SharedProps.Caption = "TextBox Tool"
		textTool.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Warning.Handle)
		comboTool.SharedProps.Caption = "ComboBox Tool"
		comboTool.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Application.Handle)
		colorTool.SharedProps.Caption = "PopupColorPicker Tool"
		colorTool.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Information.Handle)
		fontTool.SharedProps.Caption = "FontList Tool"
		fontTool.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Exclamation.Handle)

		' Always add new tools to the UltraToolbarManager's root tools collection
		' before adding them to menus or toolbars.
		Me.UltraToolbarsManager1.Tools.AddRange(New ToolBase() {textTool, comboTool, colorTool, fontTool})

		' Add the same set if tools to each popup menu
		popupMenu3.Tools.AddToolRange(New String() {"TextTool", "ComboTool", "ColorTool", "FontTool"})
		popupMenu4.Tools.AddToolRange(New String() {"TextTool", "ComboTool", "ColorTool", "FontTool"})
		popupMenu5.Tools.AddToolRange(New String() {"TextTool", "ComboTool", "ColorTool", "FontTool"})
		popupMenu6.Tools.AddToolRange(New String() {"TextTool", "ComboTool", "ColorTool", "FontTool"})


		' ----------------------------------------------------------------------------
		' Create a toolbar and add the popup menus to it.
		Me.UltraToolbarsManager1.Toolbars.AddToolbar("MyPopupMenuToolbar2")

		Me.UltraToolbarsManager1.Toolbars("MyPopupMenuToolbar2").Tools.AddToolRange(New String() {"PopupMenu3", "PopupMenu4", "PopupMenu5", "PopupMenu6"})


		' ----------------------------------------------------------------------------
		' Change some default settings for ALL menus by accessing the MenuSettings 
		' property on UltraToolbarsManager.
		Me.UltraToolbarsManager1.MenuSettings.Appearance.BackColor = Color.Blue
		Me.UltraToolbarsManager1.MenuSettings.Appearance.ForeColor = Color.Cyan
		Me.UltraToolbarsManager1.MenuSettings.EditAppearance.BackColor = Color.Red
		Me.UltraToolbarsManager1.MenuSettings.HotTrackAppearance.BackColor = Color.White
		Me.UltraToolbarsManager1.MenuSettings.IsSideStripVisible = DefaultableBoolean.True
		Me.UltraToolbarsManager1.MenuSettings.PopupStyle = PopupStyle.Menu
		Me.UltraToolbarsManager1.MenuSettings.PressedAppearance.BackColor = Color.Silver
		Me.UltraToolbarsManager1.MenuSettings.SideStripAppearance.BackColor = Color.LightBlue
		Me.UltraToolbarsManager1.MenuSettings.SideStripAppearance.ForeColor = Color.Yellow
		Me.UltraToolbarsManager1.MenuSettings.SideStripText = "Infragistics"
		Me.UltraToolbarsManager1.MenuSettings.SideStripWidth = 45
		Me.UltraToolbarsManager1.MenuSettings.ToolAppearance.BackColor = Color.Black
		Me.UltraToolbarsManager1.MenuSettings.ToolDisplayStyle = ToolDisplayStyle.TextOnlyAlways


		' ----------------------------------------------------------------------------
		' Override some of the settings for just 'PopupMenu5' by accessing the Settings 
		' property on the 'PopupMenu5'.  This will only affect 'PopupMenu5'.
		' Allocate stack variable of type PopupMenuTool from the 'PopupMenu5' tool in 
		' UltraToolbarManager's root tools collection so we can access the tools
		' properties without casting.
		Dim popupToolTemp As PopupMenuTool = Me.UltraToolbarsManager1.Tools("PopupMenu5")

		popupToolTemp.Settings.Appearance.BackColor = Color.Red
		popupToolTemp.Settings.Appearance.ForeColor = Color.Pink
		popupToolTemp.Settings.ToolAppearance.FontData.Bold = DefaultableBoolean.True
		popupToolTemp.Settings.ToolAppearance.FontData.Italic = DefaultableBoolean.True
		popupToolTemp.Settings.PopupStyle = PopupStyle.Toolbar


		' Display the resolved value of SideStripWidth in the output window.  This will
		' display 45 (the value set above off the UltraToolbarManager's MenuSettings object)
		Debug.WriteLine("PopupMenu SideStripWidthResolved before override: " + popupToolTemp.SettingsResolved.SideStripWidthResolved.ToString())

		' Override the value of of the SideStripWidth setting for this menu.
		popupToolTemp.Settings.SideStripWidth = 60

		' Display the resolved value of SideStripWidth again.  This will now
		' display 60 - the overridden value we set on the popup menu's Settings object.
		Debug.WriteLine("PopupMenu SideStripWidthResolved after override: " + popupToolTemp.SettingsResolved.SideStripWidthResolved.ToString())

	End Sub
using System.Diagnostics;
using Infragistics.Win;
using Infragistics.Win.UltraWinToolbars;

		private void button5_Click(object sender, System.EventArgs e)
		{

			// ----------------------------------------------------------------------------
			// Create some PopupMenuTools.
				PopupMenuTool popupMenu3	= new PopupMenuTool("PopupMenu3");
				PopupMenuTool popupMenu4	= new PopupMenuTool("PopupMenu4");
				PopupMenuTool popupMenu5	= new PopupMenuTool("PopupMenu5");
				PopupMenuTool popupMenu6	= new PopupMenuTool("PopupMenu6");

				// Always add new tools to the UltraToolbarManager's root tools collection
				// before adding them to menus or toolbars.
				this.ultraToolbarsManager1.Tools.AddRange(new ToolBase [] {popupMenu3, popupMenu4, popupMenu5, popupMenu6} );


				// Set some properties on the Popup menus
				popupMenu3.SharedProps.Caption	= "Popup Menu 3";
				popupMenu4.SharedProps.Caption	= "Popup Menu 4";
				popupMenu5.SharedProps.Caption	= "Popup Menu 5";
				popupMenu6.SharedProps.Caption	= "Popup Menu 6";


			// ----------------------------------------------------------------------------
			// Create a some tools and add them to the menus.
				TextBoxTool			 textTool	= new TextBoxTool("TextTool");		 
				ComboBoxTool		 comboTool	= new ComboBoxTool("ComboTool");
				PopupColorPickerTool colorTool	= new PopupColorPickerTool("ColorTool");
				FontListTool		 fontTool	= new FontListTool("FontTool");

				// Set some properties on the tools.
				textTool.SharedProps.Caption							= "TextBox Tool";
				textTool.SharedProps.AppearancesSmall.Appearance.Image	= Bitmap.FromHicon(SystemIcons.Warning.Handle);
				comboTool.SharedProps.Caption							= "ComboBox Tool";
				comboTool.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Application.Handle);
				colorTool.SharedProps.Caption							= "PopupColorPicker Tool";
				colorTool.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Information.Handle);
				fontTool.SharedProps.Caption							= "FontList Tool";
				fontTool.SharedProps.AppearancesSmall.Appearance.Image	= Bitmap.FromHicon(SystemIcons.Exclamation.Handle);

				// Always add new tools to the UltraToolbarManager's root tools collection
				// before adding them to menus or toolbars.
				this.ultraToolbarsManager1.Tools.AddRange(new ToolBase [] {textTool, comboTool, colorTool, fontTool} );

				// Add the same set if tools to each popup menu
				popupMenu3.Tools.AddToolRange(new string [] {"TextTool", "ComboTool", "ColorTool", "FontTool"} );
				popupMenu4.Tools.AddToolRange(new string [] {"TextTool", "ComboTool", "ColorTool", "FontTool"} );
				popupMenu5.Tools.AddToolRange(new string [] {"TextTool", "ComboTool", "ColorTool", "FontTool"} );
				popupMenu6.Tools.AddToolRange(new string [] {"TextTool", "ComboTool", "ColorTool", "FontTool"} );


			// ----------------------------------------------------------------------------
			// Create a toolbar and add the popup menus to it.
				this.ultraToolbarsManager1.Toolbars.AddToolbar("MyPopupMenuToolbar2");

				this.ultraToolbarsManager1.Toolbars["MyPopupMenuToolbar2"].Tools.AddToolRange(new string [] {"PopupMenu3", "PopupMenu4", "PopupMenu5", "PopupMenu6"} );


			// ----------------------------------------------------------------------------
			// Change some default settings for ALL menus by accessing the MenuSettings 
			// property on UltraToolbarsManager.
				this.ultraToolbarsManager1.MenuSettings.Appearance.BackColor			= Color.Blue;
				this.ultraToolbarsManager1.MenuSettings.Appearance.ForeColor			= Color.Cyan;
				this.ultraToolbarsManager1.MenuSettings.EditAppearance.BackColor		= Color.Red;
				this.ultraToolbarsManager1.MenuSettings.HotTrackAppearance.BackColor	= Color.White;
				this.ultraToolbarsManager1.MenuSettings.IsSideStripVisible				= DefaultableBoolean.True;
				this.ultraToolbarsManager1.MenuSettings.PopupStyle						= PopupStyle.Menu;
				this.ultraToolbarsManager1.MenuSettings.PressedAppearance.BackColor		= Color.Silver;
				this.ultraToolbarsManager1.MenuSettings.SideStripAppearance.BackColor	= Color.LightBlue;
				this.ultraToolbarsManager1.MenuSettings.SideStripAppearance.ForeColor	= Color.Yellow;
				this.ultraToolbarsManager1.MenuSettings.SideStripText					= "Infragistics";
				this.ultraToolbarsManager1.MenuSettings.SideStripWidth					= 45;
				this.ultraToolbarsManager1.MenuSettings.ToolAppearance.BackColor		= Color.Black;
				this.ultraToolbarsManager1.MenuSettings.ToolDisplayStyle				= ToolDisplayStyle.TextOnlyAlways;


			// ----------------------------------------------------------------------------
			// Override some of the settings for just 'PopupMenu5' by accessing the Settings 
			// property on the 'PopupMenu5'.  This will only affect 'PopupMenu5'.
				// Allocate stack variable of type PopupMenuTool from the 'PopupMenu5' tool in 
				// UltraToolbarManager's root tools collection so we can access the tools
				// properties without casting.
				PopupMenuTool popupToolTemp = this.ultraToolbarsManager1.Tools["PopupMenu5"] as PopupMenuTool;

				popupToolTemp.Settings.Appearance.BackColor		= Color.Red;
				popupToolTemp.Settings.Appearance.ForeColor		= Color.Pink;
				popupToolTemp.Settings.ToolAppearance.FontData.Bold	= DefaultableBoolean.True;
				popupToolTemp.Settings.ToolAppearance.FontData.Italic	= DefaultableBoolean.True;
				popupToolTemp.Settings.PopupStyle			= PopupStyle.Toolbar;


				// Display the resolved value of SideStripWidth in the output window.  This will
				// display 45 (the value set above off the UltraToolbarManager's MenuSettings object)
				Debug.WriteLine("PopupMenu SideStripWidthResolved before override: " + popupToolTemp.SettingsResolved.SideStripWidthResolved.ToString());

				// Override the value of of the SideStripWidth setting for this menu.
				popupToolTemp.Settings.SideStripWidth	= 60;

				// Display the resolved value of SideStripWidth again.  This will now
				// display 60 - the overridden value we set on the popup menu's Settings object.
				Debug.WriteLine("PopupMenu SideStripWidthResolved after override: " + popupToolTemp.SettingsResolved.SideStripWidthResolved.ToString());

		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also