How To Limit DockManager Region

Docking/MDI for Windows Forms Forum

Posted 15 years ago by Boyd - Automated Software Testing Consultant / Developer, Patterson Consulting, LLC
Avatar
I'm currently using an ActiveX control for my menu system. Amont other things, this menu system allows me to float CommandBars and dock them to any of the four sides of the main window.

The problem I'm running into is that DockControls wants to take up the full client area of the window, and some of this window is being used by my ActiveX menu system. Would it be possible to indicate a left, top, right, and bottom offset for DockControls so that I can keep it from drawing on top of my other controls operating on the same form?

Alternatively, is there a way to specify a different container than the Main Form and still get full functionality with MDI child windows? If that were the case, I could control the size/location of the container within my main form to prevent it from overlapping my other controls.

Thanks for the help. I'm looking forward to using these new controls.

Comments (5)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hmm... the dock controls should always be trying to be "innermost". Note that we have a status bar docked at the bottom of our sample form and they never dock to the outer side of that. The same behavior should be occuring for any docked control. I'm wondering if it has something to do with your command bars being ActiveX.

Anyhow, yes you can set the HostContainerControl to be something other than the Form if you'd like. I believe it can be any container control. But if you change it, you'd probably have to remove all your current tool windows in the designer first and then programmatically change it in the InitializeComponent code since once that property is set, it can't be changed.


Actipro Software Support

Posted 15 years ago by Boyd - Automated Software Testing Consultant / Developer, Patterson Consulting, LLC
Avatar
Thanks. The ActiveX controls don't actually get Docked like the status bar in your sample, so that's presenting the primary problem. Otherwise, I don't think there would be a problem. I'm not sure docking is an option in this situation since the control allows you to simultaneous dock CommandBars to all four sides of the Main Form.

At this point, I'm not using the Designer since I've created individual UserControls for each of my tool windows. I'm just creating ToolWindows programmatically and setting the ChildControl to my UserControls.

How do I get the alterate container to work? I tried adding a Panel to my main form and dragging DockManager to it. DockManager still lists the HostContainerControl as my main form. If I drop down the HostContainerControl list in the Properties for DockManager, I don't see my Panel as an available container. Do I have to set the container programmatically? Am I overlooking something obvious?
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
We'll work on allowing the HostContainerControl to be changed in the designer.

For now, if you want to change it, remove all the tool windows and change its setting via code in InitializeComponent. That will get you working on a different container.

Right now HostContainerControl is a ContainerControl. Panel doesn't inherit from that. Maybe put a UserControl instead of a Panel on your form.


Actipro Software Support

Posted 15 years ago by Boyd - Automated Software Testing Consultant / Developer, Patterson Consulting, LLC
Avatar
I ended up creating a UserControl and dropping DockManager on that control. I then just exposed the DockManager on that control as a property so that I could create a direct reference on my Main Form. I've been able to work around the ActiveX Command Bars to properly size the UserControl (and thus DockManager) within the available client area.

As suspected, normal MDI mode won't work with this technique, but Tabbed MDI does. Thanks for the suggestion!
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
We have some code implemented that should now let you change the HostContainerControl if you have no tool windows associated with it. This code will be in the next maintenance release.


Actipro Software Support

The latest build of this product (v2020.1 build 0400) was released 28 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.