Programatically serializing ToolWindow state, position and size

Docking/MDI for Windows Forms Forum

Posted 7 years ago by Michael Janulaitis - SpectorSoft
Version: 12.1.0303
Avatar

I have an application that enables users to programatically create x number of ToolWindows.  Upon re-opening a ToolWindow I would like to set the state, position and size.  I am unable to use the DockManager functions because the ToolWindows must not be loaded at startup but instead upon user interaction with the application.  There is quite an array of properties and objects to obtain the information but I am not sure what properties I need to save and what properties I need to set.  Do you have sample code that shows the correct method for programatically collecting the necessary propertes (e.g. ToolWindows.State, ToolWindow.ToolWindowContainer.RootDock, AutoHideContainer.RootDock) on closing as well as the correct method to re-apply the property values on ToolWindow create?

Comments (4)

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Michael,

The only two ways to position tool windows are:

1) Via layout deserialization where it loads multiple tool windows in a layout, but that might not work for your scenario.

2) Via the use of the programmatic docking methods described in the "Programmatic Docking" documentation topic.  Methods like DockTo, etc.

Sorry but there isn't any other way to position tool windows.  If the tool window is reopening in the same application instance, you can just call Activate and it should pop back where it was earlier.


Actipro Software Support

Posted 7 years ago by Michael Janulaitis - SpectorSoft
Avatar

Thanks for the info.  After posting this I spent the time looking at all the object variables and their settings and was able to get it to work how I wanted.  I'm using the following properties and functions:

ToolWindow.State

ToolWindow.DockTo

ToolWindow.AutoHide

ToolWindow.DockedSize

ToolWindow.ToolWindowContainer.Size

ToolWindow.FloatingLocation

ToolWindow.FloatingSize

ToolWindow.Activate

Posted 6 years ago by Michael Janulaitis - SpectorSoft
Avatar

Where can I access the DockOperationType during shutdown?

I want to be able to set the DockOperationType (e.g. BottomOutter or BottomInner) when calling ToolWindow.DockTo when the user opens the tool window.

[Modified 6 years ago]

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Michael,

I'm sorry but I don't believe we expose anything like that.  You'd have to walk the hierarchy of objects probably to determine what similar dock operation might get it near where it currently is, relative to other tool windows.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 6 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.