'宣言 Public ReadOnly Property LastEnteredElement As Infragistics.Win.UIElement
public Infragistics.Win.UIElement LastEnteredElement {get;}
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinDock Private Sub ultraDockManager1_DoubleClickSplitterBar(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinDock.PanesEventArgs) Handles ultraDockManager1.DoubleClickSplitterBar ' This event will fire if you double click the splitter ' bar adjacent to a dock area pane or a splitter bar ' between two horizontally or vertically split panes ' If (e.Panes.Length = 1 AndAlso TypeOf e.Panes(0) Is DockAreaPane) Then Dim dockArea As DockAreaPane = CType(e.Panes(0), DockAreaPane) ' Since this could happen while a drag of the splitter ' bar is pending, cancel the drag first If (Not Me.ultraDockManager1.LastEnteredElement Is Nothing) Then Me.ultraDockManager1.LastEnteredElement.ControlElement.TerminateCapture() End If Select Case dockArea.DockedLocation Case DockedLocation.DockedLeft, DockedLocation.DockedRight ' reset the width to a default width but ' keep the current height info dockArea.Size = New Size(100, dockArea.Size.Height) Case DockedLocation.DockedTop, DockedLocation.DockedBottom ' reset the height to a default width but ' keep the current width info dockArea.Size = New Size(dockArea.Size.Width, 100) End Select End If End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinDock; using System.Diagnostics; private void ultraDockManager1_DoubleClickSplitterBar(object sender, Infragistics.Win.UltraWinDock.PanesEventArgs e) { // This event will fire if you double click the splitter // bar adjacent to a dock area pane or a splitter bar // between two horizontally or vertically split panes // if (e.Panes.Length == 1 && e.Panes[0] is DockAreaPane) { DockAreaPane dockArea = e.Panes[0] as DockAreaPane; // Since this could happen while a drag of the splitter // bar is pending, cancel the drag first if (this.ultraDockManager1.LastEnteredElement != null) this.ultraDockManager1.LastEnteredElement.ControlElement.TerminateCapture(); switch (dockArea.DockedLocation) { case DockedLocation.DockedLeft: case DockedLocation.DockedRight: // Reset the width to a default width but // keep the current height info dockArea.Size = new Size(100, dockArea.Size.Height); break; case DockedLocation.DockedTop: case DockedLocation.DockedBottom: // Reset the height to a default width but // keep the current width info dockArea.Size = new Size(dockArea.Size.Width, 100); break; } } }