MDI Workspace Child Window Layout

Topics: CAB & Smart Client Software Factory
Feb 25, 2006 at 8:43 AM
originally posted by: mylesmacrae

Hi There,

I've seen this question posted a couple of times, but have never seen an answer. Using the mdiworkspace, how do oyu specify the layout of child windows/smartparts as they are created. At present, they always get put in the top left hand corner.

Feb 25, 2006 at 9:21 AM
originally posted by: matiaswoloski


The IWorkspace interface exposes a Show method that accepts an ISmartPartInfo.
Each type of Workspace has its own ISmartPartInfo. For example, the TabWorkspace uses the TabSmartPartInfo which has a Position property and a Name for the TabPage to be added. That's the way to pass the additional information.

The MdiWorkspace accepts a WindowsSmartPartInfo. This smart part info has these properties:

When you show a smartpart on the MdiWorkspace you do it like this:

WindowsSmartPartInfo info = new WindowsSmartPartInfo();
info.Location = new Point( 10, 100); // location is relative to the container
Workspaces"Mdi".Show( myView, info );

Apr 18, 2006 at 12:01 PM
originally posted by: njjones

I too have been struggling with getting the child forms to be displayed any where other than the top left of the parent window.

IWorkspace startMDI = new MDIWorkspace(mainForm);
MyView mdiChild = this.Items.AddNew<MyView>("Start");
startMDI.Show(mdiChild, StartWindowInfo());

private WindowSmartPartInfo StartWindowInfo()
WindowSmartPartInfo info = new WindowSmartPartInfo();
info.ControlBox = false;
info.Location = new System.Drawing.Point(100, 150);
info.Height = 300;
info.Width = 500;
return info;

I don't see anything that I'm doing wrong... Any help is much appreciated!