Version

TaskPaneToolResize Event

Occurs when the Control of the SelectedTaskPaneTool is being resized by the UltraToolbarsManager.
Syntax
'Declaration
 
Public Event TaskPaneToolResize As TaskPaneToolResizeEventHandler
public event TaskPaneToolResizeEventHandler TaskPaneToolResize
Event Data

The event handler receives an argument of type TaskPaneToolResizeEventArgs containing data related to this event. The following TaskPaneToolResizeEventArgs properties provide information specific to this event.

PropertyDescription
ContentAreaSize Returns the size of the content area - the size available for the control.
Control Returns the control that will be resized.
NewControlSize Returns or sets the new size for the control.
Tool (Inherited from Infragistics.Win.UltraWinToolbars.ToolEventArgs)The tool.
Example
The following sample code demonstrates how to use the TaskPaneToolResize event to adjust the size of the control contained within the task pane toolbar to allow scrolling of the control.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

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
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinToolbars;

		private void ultraButton4_Click(object sender, System.EventArgs e)
		{
			// create a new task pane toolbar and add it to
			// the toolbars collection of the manager
			UltraTaskPaneToolbar taskPane = new UltraTaskPaneToolbar("TaskPaneDemo2");
			taskPane.Text = "UltraExplorerBar";

			this.ultraToolbarsManager1.Toolbars.Add(taskPane);

			// create new task pane tools that will represents items
			// in the task pane toolbar menu
			TaskPaneTool explorerTool = new TaskPaneTool("explorer");

			// initialize their captions
			explorerTool.SharedProps.Caption = "ExplorerBar";

			// associate a control that will be displayed when the tool 
			// is selected
			explorerTool.Control = this.ultraExplorerBar1;

			// create the root level tools
			this.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;
		}

		private void ultraToolbarsManager1_TaskPaneToolResize(object sender, Infragistics.Win.UltraWinToolbars.TaskPaneToolResizeEventArgs e)
		{
			// 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 (e.Control is Infragistics.Win.UltraWinExplorerBar.UltraExplorerBar)
			{
				Size newSize = 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, ((Infragistics.Win.UltraWinExplorerBar.UltraExplorerBar)e.Control).GetLogicalControlHeight());

				e.NewControlSize = newSize;
			}
		}
Requirements

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

See Also