Quote:
Originally Posted by Jamesc146
what would I change location to? would it be half of 312? Meaning
Location="156,520"?
|
Normally I would say no, since it seemed too easy a calculation. For the button to be fully visible, its parent window would need to be at least (312+42)=354px wide. Then you didn't really account for the center of the child control you're moving either.
Essentially what you want to center something is:
(ParentWidth / 2) - (ChildWidth / 2)
(354 / 2) - (42 / 2)
(177) - (21)
156
Oddly the result is the same as you guessed at. Though I have a feeling your button isn't pressed all the way against the edge of the window. So you'll need to plug in the real numbers.