バージョン

OptionSetKey プロパティ

このツールが指定される OptionSet のキーを取得するまたは設定します。
シンタックス
'宣言
 
Public Property OptionSetKey As String
public string OptionSetKey {get; set;}

プロパティ値

このツールが指定される OptionSet のキー。
例外
例外解説
System.NotSupportedExceptionプロパティは、基本の Form または UserControl で定義された UltraToolbarsManager 内のツールに対して、デザインタイムに修正されます。継承されたツールは、作成された Form または UserControl のデザイナーを通して、ランタイムまたはデザインタイムに修正される必要があります。
解説

OptionSet は、互いに排他的な状態ボタンのグループを設定するために使用されます。排他的グループで状態ボタンのひとつをチェックすると(押すと)、そのグループのすべての他のボタンも未チェックになります。OptionSet がこのプロパティから StateButtonTool に指定される場合、OptionSet に指定される他の状態ボタンでツールは排他的グループの一部になります。

使用例
Imports System.Diagnostics
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinToolbars

	Private Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button21.Click

		Debug.WriteLine("Tool property values")

		Debug.IndentLevel += 1
		Dim toolbar As UltraToolbar
		For Each toolbar In Me.UltraToolbarsManager1.Toolbars
			Debug.WriteLine("Toolbar '" + toolbar.Key + "' tool info -----------------------")

			Debug.IndentLevel += 1

			Me.ProcessToolsCollection(toolbar.Tools)

			Debug.IndentLevel -= 1
		Next

		Debug.IndentLevel -= 1

	End Sub

	Private Sub ProcessToolsCollection(ByVal tools As ToolsCollection)

		Dim tool As ToolBase

		For Each tool In tools
			Debug.IndentLevel += 1

			' すべてのツールの共有プロパティを表示します (ToolBase から継承します)
			Debug.WriteLine("Tool #" + tool.Index.ToString() + " (Key: " + tool.Key + ") is a " + tool.GetType().Name.ToString())
			Debug.IndentLevel += 1

			' 各ツール タイプに固有のプロパティを表示します
			If TypeOf (tool) Is ComboBoxTool Then
				Dim comboBoxTool As ComboBoxTool = tool

				If Not comboBoxTool.SelectedItem Is Nothing Then
					Debug.WriteLine("Its SelectedItem is of type: " + comboBoxTool.SelectedItem.ToString())
				End If
			End If

			If TypeOf (tool) Is ControlContainerTool Then
				Dim controlContainerTool As ControlContainerTool = tool

				If controlContainerTool.CanSetWidth = True Then
					Debug.WriteLine("Its width CAN be set.")
				Else
					Debug.WriteLine("Its width CANNOT be set.")
				End If

				Debug.WriteLine("Its VerticalDisplayStyle is: " + controlContainerTool.VerticalDisplayStyle.ToString())
			End If

			If TypeOf (tool) Is FontListTool Then
				Dim fontListTool As FontListTool = tool

				Dim mruItems As String = ""

				Dim mruItem As String
				For Each mruItem In fontListTool.MruItems
					mruItems += "[" + mruItem + "] "
				Next

				Debug.WriteLine("Its MruItems collection contains the following items: " + mruItems)
			End If

			If TypeOf (tool) Is ListTool Then
				Dim listTool As ListTool = tool

				If Not listTool.SelectedItem Is Nothing Then
					Debug.WriteLine("Its SelectedItem is of type: " + listTool.SelectedItem.ToString())
				End If

				Debug.WriteLine("Its SelectedItemIndex is: " + listTool.SelectedItemIndex.ToString())
			End If

			If TypeOf (tool) Is MdiWindowListTool Then
				Dim mdiWindowListTool As MdiWindowListTool = tool

				If Not mdiWindowListTool.MdiContainerForm Is Nothing Then
					Debug.WriteLine("Its Mdi container form's name is: " + mdiWindowListTool.MdiContainerForm.Name)
				End If

				Debug.WriteLine("Its SelectedItemIndex is: " + mdiWindowListTool.SelectedItemIndex.ToString())
			End If

			If TypeOf (tool) Is PopupColorPickerTool Then
				Dim popupColorPickerTool As PopupColorPickerTool = tool

				Debug.WriteLine("Its selected color is: " + popupColorPickerTool.SelectedColor.ToString())
				Debug.WriteLine("Its replaceable color is: " + popupColorPickerTool.ReplaceableColor.ToString())
			End If

			If TypeOf (tool) Is PopupMenuTool Then
				Dim popupMenuTool As PopupMenuTool = tool

				Debug.WriteLine("Its DropdownArrowStyle is: " + popupMenuTool.DropDownArrowStyle.ToString())
				Debug.WriteLine("Its DropdownArrowStyleResolved is: " + popupMenuTool.DropDownArrowStyleResolved.ToString())

				If popupMenuTool.IsOpen = True Then
					Debug.WriteLine("It is currently OPEN")
				Else
					Debug.WriteLine("It is currently NOT open")
				End If

				Debug.IndentLevel += 1

				Debug.WriteLine("It contains the following tools: ")

				' メニューで各ツールを処理するには、このルーチンを再帰的に呼び出します
				Me.ProcessToolsCollection(popupMenuTool.Tools)

				Debug.IndentLevel -= 1
			End If

			If TypeOf (tool) Is StateButtonTool Then
				Dim stateButtonTool As StateButtonTool = tool

				If Not stateButtonTool.OptionSet Is Nothing Then
					Debug.WriteLine("It does not have an associated OptionSet!")
				Else
					Debug.WriteLine("Its associated OptionSet's Key is: " + stateButtonTool.OptionSetKey)
					Debug.WriteLine("Its associated OptionSet's AllowAllUp property is: " + stateButtonTool.OptionSet.AllowAllUp.ToString())
					Debug.WriteLine("Its associated OptionSet's currently selected tool key is: " + stateButtonTool.OptionSet.SelectedTool.Key)

					Dim otherKeys As String = ""
					Dim optionSetTool As ToolBase
					For Each optionSetTool In stateButtonTool.OptionSet.Tools
						If optionSetTool.Key <> stateButtonTool.Key Then
							otherKeys += "[" + optionSetTool.Key + "] "
						End If
					Next

					Debug.WriteLine("Its associated OptionSet also contains tools with the following keys: " + otherKeys)
				End If
			End If

			If TypeOf (tool) Is TextBoxTool Then
				Dim textBoxTool As TextBoxTool = tool

				If textBoxTool.IsInEditMode = True Then
					Debug.WriteLine("It IS in edit mode")

					Debug.WriteLine("Its SelectedText is: '" + textBoxTool.SelectedText)
					Debug.WriteLine("Its text selection starts at position: '" + textBoxTool.SelectionStart.ToString())
					Debug.WriteLine("Its text selection is of length: '" + textBoxTool.SelectionLength.ToString())
				Else
					Debug.WriteLine("It is NOT in edit mode")
				End If
			End If

			Debug.IndentLevel -= 1
			Debug.IndentLevel -= 1
		Next

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

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

			Debug.WriteLine("Tool property values");

			Debug.IndentLevel++;
			foreach(UltraToolbar toolbar in this.ultraToolbarsManager1.Toolbars)
			{
				Debug.WriteLine("Toolbar '" + toolbar.Key + "' tool info -----------------------");

				Debug.IndentLevel++;

				this.ProcessToolsCollection(toolbar.Tools);

				Debug.IndentLevel--;
			}

			Debug.IndentLevel--;

		}

		private void ProcessToolsCollection(ToolsCollection tools)
		{

			foreach(ToolBase tool in tools)
			{
				Debug.IndentLevel++;

				// すべてのツールの共有プロパティを表示します (ToolBase から継承します)
				Debug.WriteLine("Tool #" + tool.Index.ToString() + " (Key: " + tool.Key + ") is a " + tool.GetType().Name.ToString());
				Debug.IndentLevel++;


				// 各ツール タイプに固有のプロパティを表示します
				if (tool is ComboBoxTool)
				{
					ComboBoxTool comboBoxTool = tool as ComboBoxTool;

					if (comboBoxTool.SelectedItem != null)
						Debug.WriteLine("Its SelectedItem is of type: " + comboBoxTool.SelectedItem.ToString());
				}

				if (tool is ControlContainerTool)
				{
					ControlContainerTool controlContainerTool = tool as ControlContainerTool;

					if (controlContainerTool.CanSetWidth == true)
						Debug.WriteLine("Its width CAN be set.");
					else
						Debug.WriteLine("Its width CANNOT be set.");

					Debug.WriteLine("Its VerticalDisplayStyle is: " + controlContainerTool.VerticalDisplayStyle.ToString());
				}

				if (tool is FontListTool)
				{
					FontListTool fontListTool = tool as FontListTool;

					string mruItems = "";

					foreach(string mruItem in fontListTool.MruItems)
					{
						mruItems += "[" + mruItem + "] ";
					}

					Debug.WriteLine("Its MruItems collection contains the following items: " + mruItems);
				}

				if (tool is ListTool)
				{
					ListTool listTool = tool as ListTool;

					if (listTool.SelectedItem != null)
						Debug.WriteLine("Its SelectedItem is of type: " + listTool.SelectedItem.ToString());

					Debug.WriteLine("Its SelectedItemIndex is: " + listTool.SelectedItemIndex.ToString());
				}

				if (tool is MdiWindowListTool)
				{
					MdiWindowListTool mdiWindowListTool = tool as MdiWindowListTool;

					if (mdiWindowListTool.MdiContainerForm != null)
						Debug.WriteLine("Its Mdi container form's name is: " + mdiWindowListTool.MdiContainerForm.Name);

					Debug.WriteLine("Its SelectedItemIndex is: " + mdiWindowListTool.SelectedItemIndex.ToString());
				}

				if (tool is PopupColorPickerTool)
				{
					PopupColorPickerTool popupColorPickerTool = tool as PopupColorPickerTool;

					Debug.WriteLine("Its selected color is: " + popupColorPickerTool.SelectedColor.ToString());
					Debug.WriteLine("Its replaceable color is: " + popupColorPickerTool.ReplaceableColor.ToString());
				}

				if (tool is PopupMenuTool)
				{
					PopupMenuTool popupMenuTool = tool as PopupMenuTool;

					Debug.WriteLine("Its DropdownArrowStyle is: " + popupMenuTool.DropDownArrowStyle.ToString());
					Debug.WriteLine("Its DropdownArrowStyleResolved is: " + popupMenuTool.DropDownArrowStyleResolved.ToString());

					if (popupMenuTool.IsOpen == true)
						Debug.WriteLine("It is currently OPEN");
					else
						Debug.WriteLine("It is currently NOT open");

					Debug.IndentLevel++;

					Debug.WriteLine("It contains the following tools: " );

					// メニューで各ツールを処理するには、このルーチンを再帰的に呼び出します
					this.ProcessToolsCollection(popupMenuTool.Tools);

					Debug.IndentLevel--;
				}

				if (tool is StateButtonTool)
				{
					StateButtonTool stateButtonTool = tool as StateButtonTool;

					if (stateButtonTool.OptionSet == null)
						Debug.WriteLine("It does not have an associated OptionSet!");
					else
					{
						Debug.WriteLine("Its associated OptionSet's Key is: " + stateButtonTool.OptionSetKey);
						Debug.WriteLine("Its associated OptionSet's AllowAllUp property is: " + stateButtonTool.OptionSet.AllowAllUp.ToString());
						Debug.WriteLine("Its associated OptionSet's currently selected tool key is: " + stateButtonTool.OptionSet.SelectedTool.Key);

						string otherKeys = "";
						foreach(ToolBase optionSetTool in stateButtonTool.OptionSet.Tools)
						{
							if (optionSetTool.Key != stateButtonTool.Key)
								otherKeys += "[" + optionSetTool.Key + "] ";	
						}

						Debug.WriteLine("Its associated OptionSet also contains tools with the following keys: " + otherKeys);
					}
				}

				if (tool is TextBoxTool)
				{
					TextBoxTool textBoxTool = tool as TextBoxTool;

					if (textBoxTool.IsInEditMode == true)
					{
						Debug.WriteLine("It IS in edit mode");

						Debug.WriteLine("Its SelectedText is: '" + textBoxTool.SelectedText);
						Debug.WriteLine("Its text selection starts at position: '" + textBoxTool.SelectionStart.ToString());
						Debug.WriteLine("Its text selection is of length: '" + textBoxTool.SelectionLength.ToString());
					}
					else
						Debug.WriteLine("It is NOT in edit mode");
				}

				Debug.IndentLevel--;

				Debug.IndentLevel--;
			}

		}
参照