Resize docking control in runtime

Hi all,

I would like to resize a dock control in runtime, no by drag&drop splitter but the clicking on the icon (size up/down).
In the beginning, the dock control is docking to the bottom as 1/3 of the main form height.

I am able to get the information of ChildControllers, DICurrent.rcDockArea, etc. but it isn't enough.

The visible changes appeared when I call the SetBounds method.

if (dockHost.InternalController is DockHostController dhc)
{
    var moveAbout = 50;
    foreach (var child in dhc.ParentController.ChildControllers)
    {
        if (child is DragSplitterController dsc)
        {
            var r = dsc.HostControl.Bounds;
            dsc.HostControl.SetBounds(r.X, r.Y + moveAbout, r.Width, r.Height);
        }
        else if (child is DockHostController dhc2)
        {
            var r = dhc2.HostControl.Bounds;
            dhc2.HostControl.SetBounds(r.X, r.Y + moveAbout, r.Width, r.Height - moveAbout);
        }
    }
}

This solution has side effects, the original line of splitter stayed visible (see attached DockingSideEffect.zip).

Any tips? 
Thanks.

Kind regards,
Kamil

Attachment: DockingSideEffect_7004afd2.zip

3 Replies 1 reply marked as answer

BR Bharathi Rajakantham Syncfusion Team March 2, 2021 02:01 PM UTC

Hi Kamil, 
 
Thanks for contacting Syncfusion Support. 
 
We have checked the reported query “How to resize the DockControl in run time” from our end. You can achieve your requirement using the SetControlSize method.Please check the sample for your reference. 
 
        private void button1_Click(object sender, EventArgs e) 
        { 
            this.dockingManager1.SetControlSize(this.panel1, new Size(this.panel1.Size.Width, this.panel1.Height + 2)); 
 
        } 
 
        private void button3_Click(object sender, EventArgs e) 
        { 
            this.dockingManager1.SetControlSize(this.panel1, new Size(this.panel1.Size.Width, this.panel1.Height - 2)); 
        } 
 
 
 
Please ensure our sample and let us know it satisfies your requirement if not please us more details on it. we will be glad to assist you. 
 
Regards, 
Bharathi R 
 


Marked as answer

KG Kamil Graf March 2, 2021 06:40 PM UTC

Hi Bharati,

it's exactly what I need. 

Thanks,
Kamil


BR Bharathi Rajakantham Syncfusion Team March 3, 2021 01:38 PM UTC

Hi Kamil, 
Thanks for your update. 
We would be happy to hear that the provided solution is helpful for you. Please let us know if you have any other concerns, we will be glad to assist you. 
Regards, 
Bharathi R 


Loader.
Up arrow icon