I am docking a control to the left but do not know how to set the width of the pane. I have tried changing the width of that control via VS designer but DockManager seems to decide the width by itself.
ultraDockManager1.DockControls(myControl, DockedLocation.DockedLeft, ChildPaneStyle.TabGroup);
Hi,
Try following code for your purpose. I beleive this sample will solve your problem.
this
.ultraDockManager1.DockAreas["Key"].Panes[0].DockAreaPane.Size = new Size(width, height);
Thanks for taking the time to help
In my case the width is a little bit less than I need but the height is already determined by the that of the container (the pane is docked left). So with Size I would have to hardcode the height?
BTW , would you know how I get the DockArea instance from the DockAreas collection using the Control that has been docked?
Thanks!
vrn,
As you said, the Height is determined by the container since the pane is docked to the left. This is default behavior, and there is no way to change this.
In order to get a reference to a DockAreaPane from a control that is docked, first get a reference to the DockableControlPane that the control is in using the UltraDockManager's PaneFromControl() method. You can then get a reference to the DockAreaPane from the DockableControlPane's DockAreaPane property.
~Kim~
Hi Kim,
I think my question was somehow lost in the thread. What I am trying to achieve is very simple. I have a number of panel being docked in my program but when the panel come up their widths/height are altered from the original width/height I had set for the control.
For example, for the panel docked left, the code looks like this
"myControl" has a width of "x" in VS Desiger but as a result of the docking (I believe) it shows up ith width "y". S when app comes up, the wrong width causes certain important details on that control to be hidden unless user resizes it manually (poor usability)
I would like be to bring up myControl with the desired width when the application comes up i.e. after docking. How do I make it happen?
If the Size is not big enough at runtime, you can increase it by setting the Size of the DockAreaPane. Kim's answer will get this pane for you.
Mike, Kim,
I change the Size successfully but it does not reflect on the UI. I put a watch on
ultraDockManager1.PaneFromControl(myControl).DockAreaPane.Size and see it change and see the new height on Size. What else may be keeping it from taking effect?
I had the similar problem, after calling dockAreaPane.Dock(), size of docker became of size of container control (docker filled form).
To change size of docker after Dock, you have to change Size property, on _newly_ created dockAreaPane.
// Get dock area by control:DockAreaPane areaPane = this.dockManager.PaneFromControl(this.someControl).DockAreaPane;
// Dock area and get new docked area instance:DockAreaPane newAreaPane = areaPane.Dock(DockedSide.Top);
// Set size of pane. Note that one size component will be ignored and calculated automatically as Kim Ho said:newAreaPane.Size = new Size(100,100);