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