Version

MenuDisplayStyle Property

Gets or sets the style that determines how the image is drawn for the StateButtonTool when the tool is on a PopupMenuTool or ApplicationMenuArea.
Syntax
'Declaration
 
Public Property MenuDisplayStyle As StateButtonMenuDisplayStyle
public StateButtonMenuDisplayStyle MenuDisplayStyle {get; set;}

Property Value

The style that determines how the image is drawn for the StateButtonTool when the tool is on a PopupMenuTool or ApplicationMenuArea.
Exceptions
ExceptionDescription
System.NotSupportedExceptionThe property is modified at design-time for a tool in an UltraToolbarsManager defined on a base Form or UserControl. Inherited tools must be modified at run-time or at design-time through the designer of the Form or UserControl they were created on.
System.ComponentModel.InvalidEnumArgumentExceptionThe value assigned is not defined in the StateButtonMenuDisplayStyle enumeration.
Remarks

The StateButtonTool has a different appearance depending on whether the tool is checked (pressed) or not. When the tool is located on a toolbar, it's image is changed to reflect the state of the tool. However, when placed on a menu, the tools image may or may not be displayed.

Use this property to specify how the control's checked state should be indicated when on a menu. DisplayToolImage will cause the tool's image to be displayed in the menu. The image will then be changed to indicate the checked state, just as it would on a toolbar. The DisplayCheckmark value will cause the tool to be displayed with a checkmark next to it to indicate the checked state. (The unchecked state displays a blank space where the checkmark would appear.) The tool's image, if any, will not be displayed when this option is chosen.

Example
The following code demonstrates how to create a group of StateButtonTools along with an OptionSet to control the coordination of button state across the tools. The code also places a separator in front of the first tool in the group.

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

	Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

		' ----------------------------------------------------------------------------
		' Create a StateButton tool.
		Dim stateButtonAlignLeft As New StateButtonTool("AlignLeft")
		Dim stateButtonAlignCenter As New StateButtonTool("AlignCenter")
		Dim stateButtonAlignRight As New StateButtonTool("AlignRight")


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


		' Specify images for the buttons
		stateButtonAlignLeft.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Information.Handle)
		stateButtonAlignCenter.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Exclamation.Handle)
		stateButtonAlignRight.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.WinLogo.Handle)


		' Set the menu display style for the buttons to display an image.
		stateButtonAlignLeft.MenuDisplayStyle = StateButtonMenuDisplayStyle.DisplayToolImage
		stateButtonAlignCenter.MenuDisplayStyle = StateButtonMenuDisplayStyle.DisplayToolImage
		stateButtonAlignRight.MenuDisplayStyle = StateButtonMenuDisplayStyle.DisplayToolImage


		' ----------------------------------------------------------------------------
		' Create an OptionSet object to coordinate the state (i.e., Checked or not Checked)
		' of the 3 state buttons.  
		Dim index As Integer = Me.UltraToolbarsManager1.OptionSets.Add(False, "MyAlignOptionSet")


		' Add the 3 state buttons to the option set.
		Me.UltraToolbarsManager1.OptionSets(index).Tools.AddToolRange(New String() {"AlignLeft", "AlignCenter", "AlignRight"})


		' ----------------------------------------------------------------------------
		' Check the 'AlignLeft' button.
		stateButtonAlignLeft.Checked = True


		' ----------------------------------------------------------------------------
		' Create a toolbar and add the state buttons to it.
		Me.UltraToolbarsManager1.Toolbars.AddToolbar("MyAlignmentToolbar")

		' Dock the toolbar to the bottom of the form.
		Me.UltraToolbarsManager1.Toolbars("MyAlignmentToolbar").DockedPosition = DockedPosition.Bottom

		' Add the state buttons to the toolbar.
		Me.UltraToolbarsManager1.Toolbars("MyAlignmentToolbar").Tools.AddToolRange(New String() {"AlignLeft", "AlignCenter", "AlignRight"})


		' Place a separator in front of the first button by setting its 'IsFirstInGroup' property.
		Me.UltraToolbarsManager1.Toolbars("MyAlignmentToolbar").Tools("AlignLeft").InstanceProps.IsFirstInGroup = True

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

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

			// ----------------------------------------------------------------------------
			// Create a StateButton tool.
			StateButtonTool stateButtonAlignLeft	= new StateButtonTool("AlignLeft");
			StateButtonTool stateButtonAlignCenter	= new StateButtonTool("AlignCenter");
			StateButtonTool stateButtonAlignRight	= new StateButtonTool("AlignRight");


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


			// Specify images for the buttons
			stateButtonAlignLeft.SharedProps.AppearancesSmall.Appearance.Image	 = Bitmap.FromHicon(SystemIcons.Information.Handle);
			stateButtonAlignCenter.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Exclamation.Handle);
			stateButtonAlignRight.SharedProps.AppearancesSmall.Appearance.Image  = Bitmap.FromHicon(SystemIcons.WinLogo.Handle);


			// Set the menu display style for the buttons to display an image.
			stateButtonAlignLeft.MenuDisplayStyle	= StateButtonMenuDisplayStyle.DisplayToolImage;
			stateButtonAlignCenter.MenuDisplayStyle = StateButtonMenuDisplayStyle.DisplayToolImage;
			stateButtonAlignRight.MenuDisplayStyle	= StateButtonMenuDisplayStyle.DisplayToolImage;


			// ----------------------------------------------------------------------------
			// Create an OptionSet object to coordinate the state (i.e., Checked or not Checked)
			// of the 3 state buttons.  
			int index = this.ultraToolbarsManager1.OptionSets.Add(false, "MyAlignOptionSet");


			// Add the 3 state buttons to the option set.
			this.ultraToolbarsManager1.OptionSets[index].Tools.AddToolRange( new string [] {"AlignLeft", "AlignCenter", "AlignRight"} );


			// ----------------------------------------------------------------------------
			// Check the 'AlignLeft' button.
			stateButtonAlignLeft.Checked = true;


			// ----------------------------------------------------------------------------
			// Create a toolbar and add the state buttons to it.
			this.ultraToolbarsManager1.Toolbars.AddToolbar("MyAlignmentToolbar");

				// Dock the toolbar to the bottom of the form.
				this.ultraToolbarsManager1.Toolbars["MyAlignmentToolbar"].DockedPosition = DockedPosition.Bottom;

				// Add the state buttons to the toolbar.
				this.ultraToolbarsManager1.Toolbars["MyAlignmentToolbar"].Tools.AddToolRange(new string [] {"AlignLeft", "AlignCenter", "AlignRight"});


			// Place a separator in front of the first button by setting its 'IsFirstInGroup' property.
			this.ultraToolbarsManager1.Toolbars["MyAlignmentToolbar"].Tools["AlignLeft"].InstanceProps.IsFirstInGroup = true;

		}
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