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.
Unfortunately, activation email could not send to your email. Please try again.

Auto-Balance Dockingmanager windows

Thread ID:

Created:

Updated:

Platform:

Replies:

92476 Jan 18,2010 04:37 AM Feb 2,2010 08:56 AM Windows Forms 13
loading
Tags: Tools
Administrator [Syncfusion]
Asked On January 18, 2010 04:37 AM

As per the title, I am loading my docking objects (forms) at run time. The user opens a form that loads on the left, so I left dock. The user then opens another form that I dock underneath the previous form. However, the dockingmanager asks for a size, which I can work out based on the fact that it is below one form so formheight/2. I have the option to load many such screens but I would like a way to auto-size each of the panels above/below or left/right to the average width/height of those forms next to it, hope you understand.

How can I work out how many are docked/tabbed together (I might be adding on the middle), anything you guys have done in samples that may help?

Administrator [Syncfusion]
Replied On January 18, 2010 11:07 AM

To add to this, I would like to know what style has been set to a specific form, and can do this using GetDockStyle. This however returns Fill when the form is tabbed with another, I still need to find where that form is docked, something like GetDockStyle(Form.TabbedParent). How can I get the tabbed group control or access to its dockstyle.

Nandakumar R [Syncfusion]
Replied On January 20, 2010 11:25 PM

Hi James,

I regret for the delay in getting back to you. Are you using TabbedGroupedMDIManager/TabbedMDIManager for tabbing the forms that you are loading at run time?

Can you please post a simple application of what you are trying to do, so that I shall work over that and give you the details?

Regards,
Nanda

Administrator [Syncfusion]
Replied On January 21, 2010 04:46 AM

I am using a tabbedMDIManager on the same form, but the case in need solving is non-tabbed entries.

Heres an example:

Dim Button1 As New Button
Button1.Text = "Left"
DockingManager1.DockControl(Button1, Me, Syncfusion.Windows.Forms.Tools.DockingStyle.Bottom, 200)

Dim Button2 As New Button
Button2.Text = "Middle"
Dim intWidth As Integer = Me.Width \ 2
DockingManager1.DockControl(Button2, Button1, Syncfusion.Windows.Forms.Tools.DockingStyle.Right, intWidth)

Dim Button3 As New Button
Button3.Text = "Right"
Dim intSecondWidth As Integer = Me.Width \ 3
DockingManager1.DockControl(Button3, Button2, Syncfusion.Windows.Forms.Tools.DockingStyle.Right, intSecondWidth)


If I set the width for the 3rd panel to 1/3 of the size, the middle panel is squeezed. I need a method to average out each panel, and to do this need to work out which panel is where in relative to its... friend.

So I add Button1 and find nothing else that is docked to the bottom. Next time I add Button2 I find that 1 item is already docked to bottom (I can check this by looping the controlsarray).
So now I need to add the new button at the right size (width /2) which seems to come near the mark.

Then, I add Button3 and find 2 controls, so have to set the width of those existing controls to 1/3 each to allow me to set 11/3 to the new panel. I was wondering how to change the size of tthe panels I find manually,OR if there is a better way to design this. I do not know how many of these Buttons I will have (its a form actually) or where they will go. Might have 4 on the left 3 on the right and 2 floating, its all up to the user.

PS: When I get down to a certain size (ie 100px) I will just maximise the control into the whole space, the idea of this system is to ensure that when a user opens a panel, they can see it, no more than that!!







AutoSizingSample_d1e73def.zip

Githanjali S [Syncfusion]
Replied On January 22, 2010 08:17 AM

Hi James,

Currently there is no option to (automatically)auto balance the controls that are docked to the form.The SetControlSize method can be used for this purpose,as you have done in your sample.I have attached sample according to your requirement and resized in manually.


Regards,
Githanjali



Sample_7675eb4c.zip

Administrator [Syncfusion]
Replied On January 22, 2010 09:17 AM

Thanks for the update, I don't mind modifiying the sizes manually, but I can't tell how many controls I need to be dividing by.

For example, I want to add a 3rd control to the left, so I loop through all controls and see which have a .GetDockStyle of the same type I am about to add, say DockingStyle.Bottom.

But, if 2 controls are tabbed together, I get a docking style of Tabbed returned. How do I know what side is tabbed to? Are there any methods to tell me if something is docked to the main form as opposed to another control, ie a bottomdocked control with another control that has been docked to the top of that?

Githanjali S [Syncfusion]
Replied On January 26, 2010 07:51 AM


Administrator [Syncfusion]
Replied On January 29, 2010 05:31 AM

The sample you have showing how to resize a panel manually does not work. Just change the layout to resize the height instead of the width and it can not deal with it. The height of the top and bottom panels appear to be the same size, but the middle control has been shrunk.


this.dockingManager1.DockControl(this.panel1, this, Syncfusion.Windows.Forms.Tools.DockingStyle.Left, 150);
this.dockingManager1.DockControl(this.panel2, this.panel1, Syncfusion.Windows.Forms.Tools.DockingStyle.Bottom, 150);
this.dockingManager1.DockControl(this.panel3, this.panel2, Syncfusion.Windows.Forms.Tools.DockingStyle.Bottom, 150);

this.dockingManager1.SetControlSize(this.panel1, new Size(150, (this.Height / 3)));
this.dockingManager1.SetControlSize(this.panel2, new Size(150, (this.Height / 3)));
this.dockingManager1.SetControlSize(this.panel3, new Size(150, (this.Height / 3)));


Administrator [Syncfusion]
Replied On January 29, 2010 06:15 AM

And for those that need it, the code to work out where a tabbedgroup is docked is as follows:

'Check if this is on the same size by asking its parent where it thinks it is
If TypeOf objControl.Parent Is Syncfusion.Windows.Forms.Tools.DockHost Then
With DirectCast(objControl.Parent, Syncfusion.Windows.Forms.Tools.DockHost)
If TypeOf .InternalController Is Syncfusion.Windows.Forms.Tools.DockHostController Then
With DirectCast(.InternalController, Syncfusion.Windows.Forms.Tools.DockHostController)
If TypeOf .ParentController Is Syncfusion.Windows.Forms.Tools.DockTabController Then
With DirectCast(.ParentController, Syncfusion.Windows.Forms.Tools.DockTabController)
If .DockEdge = objSyncDockStyle Then
arrDockedPanelBuddies.Add(objControl)
If TypeOf objControl Is frmPanelFormBase Then
'Check if it is a better match for this new panel
If objLinkedControl Is Nothing Then
objLinkedControl = DirectCast(objControl, frmPanelFormBase)
objLinkedControlDockStyle = .DockEdge
Else
If Math.Abs(DirectCast(objControl, frmPanelFormBase).PanelDesignPosition - PanelLayoutInfo.Position) <= Math.Abs(DirectCast(objLinkedControl, frmPanelFormBase).PanelDesignPosition - PanelLayoutInfo.Position) Then
objLinkedControl = DirectCast(objControl, frmPanelFormBase)
objLinkedControlDockStyle = .DockEdge
End If
End If
End If
End If
End With
End If
End With
End If
End With
End If

Administrator [Syncfusion]
Replied On January 29, 2010 06:25 AM

And for those that need it, the code to work out where a tabbedgroup is docked is as follows:

If TypeOf objControl.Parent Is Syncfusion.Windows.Forms.Tools.DockHost Then
With DirectCast(objControl.Parent, Syncfusion.Windows.Forms.Tools.DockHost)
If TypeOf .InternalController Is Syncfusion.Windows.Forms.Tools.DockHostController Then
With DirectCast(.InternalController, Syncfusion.Windows.Forms.Tools.DockHostController)
If TypeOf .ParentController Is Syncfusion.Windows.Forms.Tools.DockTabController Then
With DirectCast(.ParentController, Syncfusion.Windows.Forms.Tools.DockTabController)
Debug.Print(.DockEdge)
End With
End If
End With
End If
End With
End If



PS: Please delete previous post

Administrator [Syncfusion]
Replied On January 29, 2010 09:06 AM

The code I posted above seems to have an issue. If I have 2 controls tabbed together, then 2 more controls tabbed together all on the bottom. The .DockEdge says bottom for the first tab set, then right for the second tab set. Any clues on how to get bottom and bottom?

Administrator [Syncfusion]
Replied On January 29, 2010 09:23 AM

It appears I can not tell where a DockTabController is, the .DockEdge property is giving me the answer of Right, when it is at the bottom, this is with only 1 tab set not 2.

Administrator [Syncfusion]
Replied On February 1, 2010 09:38 AM

For those who need it, the property that tells you where the tab group is docked is actually

.DICurrent.dStyle

Githanjali S [Syncfusion]
Replied On February 2, 2010 08:56 AM

Hi James,

Hope your issue is solved through the direct incident created with respect to this forum.

Regards,
Githanjali

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.

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.

;