We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to programmatically set docked, tabbed, autohidden restore size

Thread ID:

Created:

Updated:

Platform:

Replies:

73888 May 23,2008 02:32 PM UTC Jul 7,2008 08:39 AM UTC WinForms 11
loading
Tags: Tools
Administrator [Syncfusion]
Asked On May 23, 2008 02:32 PM UTC

I'm trying to programmatically set the size of docked, tabbed, autohidden, controls so far to no available. Let me explain the situation: I have a file with the states of docked controls saved and wish to restore it on the program reload. We've programmatically saved the restore data ourselves and that all looks good. In my scenario, I'm restoring 5 controls grouped together and docked to the top. These windows are autohidden. The only thing I can't find a way to restore is the individual window sizes.

Let me elaborate further: when a dock group is set to auto hide, you can resize each tab to a different size, which is what I have done. The data for these sizes has been captured, but on reload, I can't find a way to restore these sizes. The DockControl function of DockingManager, even though it takes a size, resizes the newly docked window to the parent size and I can't find a way to change that size after the fact.

Any suggestions?


Fathima Shalini P [Syncfusion]
Replied On May 28, 2008 12:10 PM UTC

Hi Justin,

Thank you for your interest in Syncfusion Products.

Currently it is not possible to regain size of individual docking control that it is in AutoHide mode whose size is set before docking them as tabbed group, because it is the default behavior. This behavior can be seen with our Microsoft Visual Studio. The following videoclip illustrates this behavior:

http://websamples.syncfusion.com/samples/Tools.Windows/F73888/VideoReference.swf.zip

If I have misunderstood your requirement, could you please explain me your requirement with a simple sample, so that it would greatly help us to work out in depth and provide you a better solution?

Please let me know if any concerns.

Regards,
Fathima


Administrator [Syncfusion]
Replied On May 28, 2008 03:06 PM UTC

Let me rephrase then: is there a way to programmatically change the size of an already docked, autohidden, tab?


Mano J [Syncfusion]
Replied On May 30, 2008 05:55 AM UTC

Hi Justin,

Did you try SetControlSize method to change the size?


private void dockingManager1_AutoHideAnimationStart(object sender, AutoHideAnimationEventArgs arg)
{
if(arg.Control == panel1)
dockingManager1.SetControlSize(panel1, new Size(600, 300));
if(arg.Control == panel2)
dockingManager1.SetControlSize(panel2, new Size(600, 200));
if (arg.Control == panel3)
dockingManager1.SetControlSize(panel3, new Size(600, 100));
}



Thanks,
Mano


Administrator [Syncfusion]
Replied On May 30, 2008 01:04 PM UTC

I tried that it seems that the last control size to be set causes all the others in the group to get the same size.

I'm reading the settings for each control, docking the control in the group, and then trying to set it's size.


Fathima Shalini P [Syncfusion]
Replied On June 4, 2008 01:38 PM UTC

Hi Justin,

To set the size of the docking controls that are docked, autohidden and Tabbed together we need to use SetControlSize method in various events:

1) To set size of the docking controls that are AutoHidden:


private void dockingManager1_AutoHideAnimationStart(object sender, Syncfusion.Windows.Forms.Tools.AutoHideAnimationEventArgs arg)
{
if (arg.Control == panel1)
dockingManager1.SetControlSize(panel1, new Size(300, 600));
if (arg.Control == panel2)
dockingManager1.SetControlSize(panel2, new Size(350, 600));
if (arg.Control == panel3)
dockingManager1.SetControlSize(panel3, new Size(400, 600));
}


2) To set the size of the controls that are tabbed together:

There is no direct way to do this. But we can set the size by getting the DockTabControl object from DockHostController and using SelectedIndexChanging event of the DockTabControl. Please refer the below code snippet that illustrates this:


private void dockingManager1_NewDockStateEndLoad(object sender, EventArgs e)
{
Syncfusion.Windows.Forms.Tools.DockHost dhost = this.panel1.Parent as Syncfusion.Windows.Forms.Tools.DockHost;
Syncfusion.Windows.Forms.Tools.DockHostController dhc = dhost.InternalController as
Syncfusion.Windows.Forms.Tools.DockHostController;

if (dhc.ParentController is Syncfusion.Windows.Forms.Tools.DockTabController)
{
Syncfusion.Windows.Forms.Tools.DockTabControl docktab = (dhc.ParentController as
Syncfusion.Windows.Forms.Tools.DockTabController).TabControl;
docktab.SelectedIndexChanging += new Syncfusion.Windows.Forms.Tools.SelectedIndexChangingEventHandler(docktab_SelectedIndexChanging);

}

}


void docktab_SelectedIndexChanging(object sender, Syncfusion.Windows.Forms.Tools.SelectedIndexChangingEventArgs args)
{
if (this.dockingManager1.ControlsArray[args.NewSelectedIndex].Name == "panel1")
{
this.dockingManager1.SetControlSize(this.panel1, new Size(300, 600));
}
else if (this.dockingManager1.ControlsArray[args.NewSelectedIndex].Name == "panel2")
{
this.dockingManager1.SetControlSize(this.panel2, new Size(350, 600));
}
if (this.dockingManager1.ControlsArray[args.NewSelectedIndex].Name == "panel3")
{
this.dockingManager1.SetControlSize(this.panel3, new Size(400, 600));
}

}



3)To set the size of the docked control:


this.dockingManager1.SetControlSize(this.panel4, new Size(100, 100));


Please refer the below sample that illustrates this:

http://websamples.syncfusion.com/samples/Tools.Windows/F73888_1/main.htm

Please try this and let me know if this helps.

Regards,
Fathima


Administrator [Syncfusion]
Replied On June 9, 2008 06:44 PM UTC

The dockingManager1_AutoHideAnimationStart event did allow it to resize correctly with the size from the saved state but this solution will not work for me. Now if the user manually resizes, moves off the form and moves back, the size from the file is reloaded. Before we were updating our state file on form close. Saving the size on resize for a form doesn't work either because it overwrites the other form sizes. Is there any way to distinguish whether a size change was programmatic or from the user so that I can persist only user size changes?


Fathima Shalini P [Syncfusion]
Replied On June 16, 2008 11:17 AM UTC

Hi Justin,

Thank you for your update.

When the user changes the size of the docked control by dragging it, docking manager's DragFeedbackStop event gets triggered. So it is possible to distinguish whether a size change was programmatic or from the user, by using this event. But when we get the size of the docked control in this event gives the previous size value instead of newly set value. We suspect this issue to be a defect. We will update you once this issue is fixed.

Please let me know if any concerns.

Regards,
Fathima


Administrator [Syncfusion]
Replied On June 19, 2008 01:12 PM UTC

I tried attaching to that event, however, it doesn't provide any information. It's signature is void OnDragFeedbackStop(object aSender, EventArgs aArgs) and when I look at the arguments it sends me, aSender is the docking manager and aArgs has no info. How would I detect which control was just resized?


Fathima Shalini P [Syncfusion]
Replied On June 24, 2008 11:41 AM UTC

Hi Justin,

To get the size of the docking control using DragFeedbackStop event, please refer the below code snippets that illstrates this:


private void dockingManager1_DragFeedbackStop(object sender, EventArgs e)
{
if (this.ActiveControl != null)
{
Console.WriteLine("Width " + this.ActiveControl.Width.ToString());
Console.WriteLine("Height " + this.ActiveControl.Height.ToString());
}
}


Note: This gives the previous size of the control. This is a known issue and our developers are currently working with this.

Please let me know if any concerns.

Regards,
Fathima




Administrator [Syncfusion]
Replied On July 3, 2008 04:08 PM UTC

Please let me know when the bug is fixed. The previous size doesn't help me at all. I need the current size for it to be useful.


Fathima Shalini P [Syncfusion]
Replied On July 7, 2008 08:39 AM UTC

Hi Justin,

Thanks for your update. I update you as soon as this issue has been fixed.

Regards,
Fathima


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;