View Single Post
  #12  
Unread 01-20-2010, 09:04 PM
EQAditu's Avatar
EQAditu EQAditu is offline
A Griffon
Interface Author - Click to view interfaces
 
Join Date: Mar 2005
Server: Permafrost
Posts: 256
Default

Quote:
Originally Posted by Jamesc146 View Post
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.
Reply With Quote