'Declaration Public Property ToolbarDisplayStyle As StateButtonToolbarDisplayStyle
public StateButtonToolbarDisplayStyle ToolbarDisplayStyle {get; set;}
Exception | Description |
---|---|
System.NotSupportedException | The 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.InvalidEnumArgumentException | The value assigned is not defined in the StateButtonToolbarDisplayStyle enumeration. |
The StateButtonTool will display as a state button by default. Setting the ToolBarDisplayStyle allows the StateButtonTool to display as a CheckBox or Radio Button. When the ToolBarDisplayStyle is Glyph, the tool with display with a check mark. However, if the tool has an OptionSet, it will display like a radio button.
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinToolbars; private void CreateStateButtonToolsAndOptionSet() { // ---------------------------------------------------------------------------- // Create some StateButton tools. 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); // Make the tools display as Glyphs (radio buttons) instead of State Buttons. stateButtonAlignLeft.ToolbarDisplayStyle = StateButtonToolbarDisplayStyle.Glyph; stateButtonAlignCenter.ToolbarDisplayStyle = StateButtonToolbarDisplayStyle.Glyph; stateButtonAlignRight.ToolbarDisplayStyle = StateButtonToolbarDisplayStyle.Glyph; // ---------------------------------------------------------------------------- // 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 StateButtonTool that will not be part of the OptionSet so it will display as // a CheckBox instead of a radio button. StateButtonTool checkBoxButton = new StateButtonTool("CheckBox"); this.ultraToolbarsManager1.Tools.Add(checkBoxButton); // Specify an image for the buttons checkBoxButton.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Question.Handle); // Make the tool display as a Glyph (checkbox) instead of a state button. checkBoxButton.ToolbarDisplayStyle = StateButtonToolbarDisplayStyle.Glyph; // ---------------------------------------------------------------------------- // 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 [] {"CheckBox", "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; }
Imports System.Diagnostics Imports Infragistics.Win Imports Infragistics.Win.UltraWinToolbars Private Sub CreateStateButtonToolsAndOptionSet() ' ---------------------------------------------------------------------------- ' Create some StateButton tools. Dim stateButtonAlignLeft As StateButtonTool = New StateButtonTool("AlignLeft") Dim stateButtonAlignCenter As StateButtonTool = New StateButtonTool("AlignCenter") Dim stateButtonAlignRight As StateButtonTool = 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) ' Make the tools display as Glyphs (radio buttons) instead of State Buttons. stateButtonAlignLeft.ToolbarDisplayStyle = StateButtonToolbarDisplayStyle.Glyph stateButtonAlignCenter.ToolbarDisplayStyle = StateButtonToolbarDisplayStyle.Glyph stateButtonAlignRight.ToolbarDisplayStyle = StateButtonToolbarDisplayStyle.Glyph ' ---------------------------------------------------------------------------- ' 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 StateButtonTool that will not be part of the OptionSet so it will display as ' a CheckBox instead of a radio button. Dim checkBoxButton As StateButtonTool = New StateButtonTool("CheckBox") Me.UltraToolbarsManager1.Tools.Add(checkBoxButton) ' Specify an image for the buttons checkBoxButton.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Question.Handle) ' Make the tool display as a Glyph (checkbox) instead of a state button. checkBoxButton.ToolbarDisplayStyle = StateButtonToolbarDisplayStyle.Glyph ' ---------------------------------------------------------------------------- ' 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() {"CheckBox", "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
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