Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1145
Default size and resizing DockAreaPanes?
posted

WinForms UltraDockManager 11.2.  C# 2010.

I programmatically add 1 DockArea, 1 DockableGroupPanel, and 3 DockableControlPanes.  By default all panes load with two horizontal splitters, each pane equally sized to occupy 1/3 of the Form.  The first thing the users have to do is drag the bottom splitter down until the minimum size of the bottom pane 3 is reached (minimum size of the UltraGroupBox in that pane) so the screen is optimal for viewing data in the two grid controls in panes 1 and 2. 

Goal is to have the application open with the panes set to an optimal size.

I have tried wiring the ultraDockManager1_DoubleClickSplitterBar event per an example from these forums, but the results are ugly no matter what I try. Either the resulting size is nothing close to the new height or width values, or the pane goes from horizontal to vertically docked in the Form.

Here is the code, borrowed from a forum post:

private void ultraDockManager1_DoubleClickSplitterBar(object sender, 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 == 2 && e.Panes[0] is Infragistics.Win.UltraWinDock.DockableControlPane)
    {
        // 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 (e.Panes[1].Key.ToUpper())
        {
            case "1":

                break;
            case "2":

                break;
            case "3":
                e.Panes[3].DockAreaPane.Size = new Size(120,e.Panes[1].DockAreaPane.Size.Width);
                //e.Panes[3].DockAreaPane.Size = new Size(e.Panes[1].DockAreaPane.Size.Width, 120);
                break;
            default:
                break;
        }
    }
}

I have tried so many variations of setting the new height and width values, but I cannot achieve the desired result.

Tried the same in the FormLoad event.  It almost seems as if the height and width properties are reversed in the .Size property?  What am I missing?  Has anyone out there successfully accomplished a default view where every pane loads with a custom size?  Thanks!!!

 

  • 18495
    posted

    Hello,

    Would you be able to provide a sample project that reproduces the issue?  To attach a file to a post, select the Options tab while you're editing the post.