Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinToolbars
Private Sub UltraButton4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UltraButton4.Click
' create a new task pane toolbar and add it to
' the toolbars collection of the manager
Dim taskPane As New UltraTaskPaneToolbar("TaskPaneDemo2")
taskPane.Text = "UltraExplorerBar"
Me.UltraToolbarsManager1.Toolbars.Add(taskPane)
' create new task pane tools that will represents items
' in the task pane toolbar menu
Dim explorerTool As New TaskPaneTool("explorer")
' initialize their captions
explorerTool.SharedProps.Caption = "ExplorerBar"
' associate a control that will be displayed when the tool
' is selected
explorerTool.Control = Me.ultraExplorerBar1
' create the root level tools
Me.UltraToolbarsManager1.Tools.Add(explorerTool)
' add the tools to the task pane toolbar
taskPane.Tools.AddTool("explorer")
' dock the toolbar to the left
taskPane.DockedPosition = DockedPosition.Left
' by default have the controls resize to fill the available
' content area of the task pane
taskPane.ToolResizeMode = TaskPaneToolResizeMode.AutoSizeBothDimensions
' however, for the explorerbar, we want to just
' initialize the non scrolling extent - i.e.
' when scrolling vertically, the width of the
' control will be adjusted but not the height
explorerTool.ResizeMode = TaskPaneToolResizeMode.AutoSizeNonScrollingDimension
' when the task pane toolbar does not have enough room
' to display the full height of the control, scroll
' buttons are displayed. the appearance can be controlled
' with properties on the UltraTaskPaneToolbar
taskPane.ScrollButtonAppearance.ForeColor = Color.Black
End Sub
Private Sub UltraToolbarsManager1_TaskPaneToolResize(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinToolbars.TaskPaneToolResizeEventArgs) Handles UltraToolbarsManager1.TaskPaneToolResize
' The TaskPaneToolResize event is invoked whenever the
' size of the control associated with the SelectedTaskPaneTool
' is to be adjusted. This occurs when the tool is selected
' as well as when the task pane toolbar is resized.
' take the recommended size as the default size
If TypeOf e.Control Is Infragistics.Win.UltraWinExplorerBar.UltraExplorerBar Then
Dim newSize As Size = e.NewControlSize
' initialize the width so we can ask the explorer bar
' for the height. note, this will only work properly
' if the scrollbars property of the control is set
' to never
e.Control.Width = newSize.Width
' use the larger of the available height and
' the height needed by the explorer bar to show
' its contents
newSize.Height = Math.Max(e.ContentAreaSize.Height, CType(e.Control, Infragistics.Win.UltraWinExplorerBar.UltraExplorerBar).GetLogicalControlHeight())
e.NewControlSize = newSize
End If
End Sub