MDI Child form .StartPosition incorrect

  • Thread starter Thread starter Mr.Tickle
  • Start date Start date
M

Mr.Tickle

Creating an MDI child window with the following code...

Form f1 = new Form();

f1.Text = "child form 1";

f1.MdiParent = this;

f1.StartPosition = FormStartPosition.CenterParent





Doesnt make the MDI child in the center of the MDI parent frame. I have to
use .CenterScreen to get it centered in the form.



This seems odd, shouldnt .CenterParent make it Center?
 
* "Mr.Tickle said:
Creating an MDI child window with the following code...

Form f1 = new Form();

f1.Text = "child form 1";

f1.MdiParent = this;

f1.StartPosition = FormStartPosition.CenterParent

Doesnt make the MDI child in the center of the MDI parent frame. I have to
use .CenterScreen to get it centered in the form.

This seems odd, shouldnt .CenterParent make it Center?

MDI forms are different from other forms...

;-)
 
Still seems odd. why would Center SCREEN work and PARENT not? The frame is
the PARENT.
 
Mr.Tickle,
Is this in VS.NET 2002 or VS.NET 2003?

I tested VS.NET 2003 and it is behaving the way you describe.

FormStartPosition.CenterParent states "The form is centered within the
bounds of its parent form", notice the words "parent form"! How do you get a
form to have a parent? Where having a parent is different form being a MDI
child or an owned form. As I am not seeing that CenterParent does anything
for other kinds of forms.

MdiChildren's Parent property is the MdiClient (not the MdiParent Form
value).

For Owned forms (setting Form.Owner, the parent property is blank).

I'm with Herfried on this one, MDI forms are different. I'm still
researching how to make a form a Parent of another form (I seem to remember
its relatively easy, I just do not remember). I'll report back if I find
anything.

Hope this helps
Jay
 
Mr.Tickle,
I found how to make the form have a Parent. I knew it was simply, I was just
missing the TopLevel property earlier... (Doh!)

Dim child as New Form
child.TopLevel = False
child.Parent = Me
child.StartPosition = FormStartPosition.CenterParent
child.Show()

Even in this case I do not see that FormStartPosition.CenterParent actually
does anything! In the above the Parent property is actually the parent form.

I'm not so sure that its so much the MDI forms are special, it appearst that
CenterParent doesn't actually do anything. At least for me in VS.NET 2003 on
Win XP...

Hope this helps
Jay
 
Back
Top