antonboskovski
05-22-2002, 04:44 AM
hi
I want when I strat a form no mather what is the screen resolution the form to be in the center. Is there something like that. thankz in advance
toni
Agent
05-22-2002, 04:56 AM
You could set the form's startUpPosition to CenterScreen
then set the form's moveable property to false.
I really don't know why you want to do this though, it
is very user unfriendly.
antonboskovski
05-22-2002, 08:19 AM
can you send me the code
I'm new
reboot
05-22-2002, 08:20 AM
There's not any code. What he suggested is done via the forms properties.
Robby
05-22-2002, 10:10 AM
try this in the form load event...
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
Agent
05-22-2002, 01:23 PM
Better yet, place that code in the form_resize event.
duncallen
05-22-2002, 02:30 PM
I am trying to something similar but am having difficulty if the form is an MDI Child?
I cant use the center screen start up property
I like the idea of the resize code that Robby provided, but it for some reson is not centering my forms
BillSoo
05-22-2002, 02:33 PM
If the form is an mdichild, you should use the mdiform scalewidth and scaleheight properties instead of screen.width and height....
Robby
05-22-2002, 03:08 PM
Agent, the problem with putting it in the resize event, each time the user resizes the form, it will move to the center.:(
I think that was his point, though. This way, the form will still be centered when you resize. You could still move the form manually if you wanted. But then if you moved the form and then resized it, it'd move it back. It wouldn't be too hard to write some code that would recenter a form on it's current center point after resizing.
But I think that's getting away from the Thread Starter's point. :rolleyes: