Jemery,
First of all I am pretty new with DockingPanes. This is what I do:
1) Create the panes and attach them to form.hwnd. (when the app runs for the first time there's nothing in the registry)
2) Use the DockingPaneManager_AttachPane event to attach the panes to the forms. (simular to the CreatePanes function).
The first time the app runs, the panes will be positioned like I wanted in the CreatePanes function. On shutdown the positions will be saved with DockingPaneManager.SaveState function. When starting the app again the registry will be filled with the settings saved the last time the app was running. Now to get these settings I use the DockingPaneManager.LoadState function. So now all the code in the CreatePanes function doesn't do anything anymore because the DockingPaneManager.LoadState overrides that. Now the DockingPaneManager_AttachPane event will attach the pane to the form.
This will work because the user will position the panes to their own needs. BUT: I'm still working on my project and create a pane that I want to add to my main window. This pane doesn't exist in the registry so the pane will not be visible, I don't know why, but it doesn't. This is what I do: don't call Loadstate, then all the panes will be created and shown. Position the panes like I want to and shut the app. SaveState function will save the settings and voila. Next time the panes are positioned with LoadState function.
I don't know if this is the right approach.
Maybe you have a better solution for me, please let me know
Thank you in advance
|