'宣言 Public Property ToolbarDisplayStyle As StateButtonToolbarDisplayStyle
public StateButtonToolbarDisplayStyle ToolbarDisplayStyle {get; set;}
例外 | 解説 |
---|---|
System.NotSupportedException | プロパティは、基本の Form または UserControl で定義された UltraToolbarsManager 内のツールに対して、デザインタイムに修正されます。継承されたツールは、作成された Form または UserControl のデザイナーを通して、ランタイムまたはデザインタイムに修正される必要があります。 |
System.ComponentModel.InvalidEnumArgumentException | 指定した値が StateButtonToolbarDisplayStyle 列挙体に定義されていません。 |
StateButtonTool はデフォルトで状態ボタンとして表示されます。ToolBarDisplayStyle を設定することで、CheckBox または Radio Button として StateButtonTool を表示できます。ToolBarDisplayStyle が Glyph の時、ツールはチェックマークとともに表示します。ただし、ツールに OptionSet がある場合、ラジオ ボタンのように表示されます。
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