Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple: Good Practice for Form Positions

Status
Not open for further replies.

mojoT

Technical User
Sep 23, 2003
25
NZ
I've managed to get my child forms to open in the top left corner of my MDI using the me.left = 0 and me.top = 0 in the child forms load function. The start position property is set to Windows default.

Is it better practice to do it the method above, or should i just change the start position property for that form to manual as it does the same thing?

OR

Is it better to change start position to manual AND do the me.left = 0 thing?

I want the most efficient way, or some idea on which is the best practice.

[ponder]
 
Mojo,

In the pure sense, setting it as a property is more efficient I suppose.
But I doubt there's a lot of difference in operation, I'm sure it's negligible.

phan
 
As long as you don't default to "center of screen". I have a dual-monitor setup, and I find that intensely annoying, as the form is split between them.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
For center-screen problems, I've had some good fortune using the Screens' bounds...

System.Windows.Forms.Screen.PrimaryScreen.Bounds

contains both Width and Height properties. Then a quick calculation allows me to center the form on the primary screen.

However, as for the discussion about form property vs. code... I'd lean toward code for any app that I actually care where the forms end up. That way I don't have to remember that Form abc is set to do it this way, and Form xyz does it this other way... I can just look for the function that controls it. That's just me, though... I would agree with the others that performance-wise, there's not much difference. As for good practice? Just make sure you're consistent, and make sure it's documented, even if you don't actually do it in code. There won't be any confusion that way.

Ben
A programmer was drowning. Lots of people watched but did nothing. They couldn't understand why he yelled "F1!"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top