CenterParent not working

I

Ivan Weiss

I have the windows startup position on a child form to centerParent.

The calling code to the form is:

Dim objBackground As New frmBackground

objBackground.MdiParent = Me
'objBackground.Width = Me.ClientSize.Width * 0.97
'objBackground.Height = Me.ClientSize.Height * 0.92
objBackground.Width = Me.ClientSize.Width * 0.9
objBackground.Height = Me.ClientSize.Height * 0.9
objBackground.StartPosition = FormStartPosition.CenterParent
objBackground.Show()
End Sub

Any ideas on why my form is loading towards the top left of the corner
instead of centered on the parent mdi container?

-Ivan
 
H

Herfried K. Wagner [MVP]

* Ivan Weiss said:
I have the windows startup position on a child form to centerParent.

The calling code to the form is:

Dim objBackground As New frmBackground

objBackground.MdiParent = Me
'objBackground.Width = Me.ClientSize.Width * 0.97
'objBackground.Height = Me.ClientSize.Height * 0.92
objBackground.Width = Me.ClientSize.Width * 0.9
objBackground.Height = Me.ClientSize.Height * 0.9
objBackground.StartPosition = FormStartPosition.CenterParent
objBackground.Show()
End Sub

Any ideas on why my form is loading towards the top left of the corner
instead of centered on the parent mdi container?

This is "by design" for MDI children.
 
I

Ivan Weiss

So there is no way to center a form within an MDI client area? Am I
better off to just setting it to center screen? I don't understand why
this wouldn't be a functional option considering it is provided.

-Ivan
 
B

Brian Henry

it's provided mainly for modal dialog boxes, not child forms in MDI... MDI
limits a lot of functionality, that is why people are generally createing
SDI applications now
 
I

Ivan Weiss

If SDI seems to be the way most apps are being designed now than why do
major apps for example most Microsoft products, accounting software
packages, email programs, etc... use MDI interfaces. Are there any
examples of nice SDI interfaces cause in my personal experience they
always seem like "cheaper" less professional type of apps if you know
what I mean.

I am open to going with an SDI implementation but I thought MDI was more
appealing to the eye.

-Ivan
 
B

Brian Henry

microsoft actaully uses SDI now for a lot of apps... they have been
switching over a lot, MS word is now SDI for example
 
S

Stephany Young

I think that you might be getting a little confused with Parent, Child,
MDIParent and MDIChild forms. Parent and MDIParent forms are not the same
thing nor are Child and MDIChild forms the same thing. It is very easy to
forget this because the differences are quite subtle.

When you open an MDIChild form, you set it's MDIParent property rather than
it's Parent property. This logocally renders the
FormStartPosition.CenterParent value for StartPosition redundant. Unless you
have a specific need, you should set the StartPosition for an MDIChild form
to FormStartPosition.DefaultBounds. This causes MDIChild forms to be opened
'cascaded' within the confines of the MDIClient area of the MDIParent form.
 
H

Herfried K. Wagner [MVP]

* Ivan Weiss said:
If SDI seems to be the way most apps are being designed now than why do
major apps for example most Microsoft products, accounting software
packages, email programs, etc... use MDI interfaces. Are there any
examples of nice SDI interfaces cause in my personal experience they
always seem like "cheaper" less professional type of apps if you know
what I mean.

If you have a closer look, most new MSFT applications do not use real
MDI any more.
I am open to going with an SDI implementation but I thought MDI was more
appealing to the eye.

I liked MDI too, but it will die...
 
A

Armin Zingler

Brian Henry said:
it's provided mainly for modal dialog boxes, not child forms in
MDI... MDI limits a lot of functionality, that is why people are
generally createing SDI applications now

I hate SDI applications. Apart from the one-Form tools (that have been
put into an MDI window meanwhile), all my applications are MDI apps
because they are much easier to handle (IMO). The first thing I did
after installing Access 2000 was switch back to the MDI
style because I have everything in one place - and I wanted to be able
to Alt+Tab through apps not through windows. I think the things that Ivan
tries (including the always-maximized child thing) are not really necessary
for the most applications or can be done manually. Of course these are
personal preferences only.
 
I

Ivan Weiss

Thank you everyone for your feedback. I think what is really the center
issue here for me is I am developing an app that down the road I want to
incorporate an enormous amount of features. And having the SDI
structure for me would mean a lot of small forms opening on top of each
other which is essentially to me like keeping a messy stack of papers on
your desk. I always viewed the MDI structure, to follow my example, as
a way of keeping the stack of a papers in a bin so it stays neat. If
the user wants to minimize my program they just hit one minimize button,
not one for every window they have open. That is why I do not see why
the SDI structure would be better at this point. Most of my forms are
quite small and will not take up the entire screen (they are wide but
not high) so I just think keeping them in the mdi child area is a nicer
presentation and lets me keep them together. In Word there is only one
window open at a time so I guess the SDI works well but my app is
comprised of a lot of different forms and the user will be switching
between these often.

Am I going on the right path, based on this does MDI still sound correct
or am I missing something with the SDI structure?

-Ivan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top