Many thanks Rajasekar,
having played with the code, I think I have found a couple of bugs. In a set of circumstances the DockHost does not report the correct docking style for the controls. Maybe there is a call to the DockingManager to refresh the state that I am missing.
Please look at your modified project you will find attached. Using the method you suggested earlier on this post, I cast the Parent of the docked control to the DockHost and then query the DragDockInfo.dStyle to attain the docking style. This works perfectly in most cases.
In the modified soultion I have added another message box when the user presses the 'Treeview Docked To' menu button that reports the treeview1 dock style.
If you follow the set of circumstances below, the one or both message boxes report the wrong information:
Issue 1.
Press 'Treeview Docked To' - correctly reports dock parent as main form, but suggests DockStyle is left - in fact it is TOP.
Issue 2.
dock treeview2 to right of main form.
dock treeview1 to bottom of treeview 2.
Press 'Treeview Docked To' - correctly reports dock parent as treeview2 and style as Bottom.
dock treeview2 to bottom of main form.
Press 'Treeview Docked To' - incorrectly reports dock parent as treeview2 and style as Bottom. It should now be docked to main form and dock style of right.
Please can you suggest the method I should use to solve this issue.
Matt
DockingMgr_fe8bf02f.zip