Page 1 of 1

how do i center an image in a window ?!?

Posted: Mon Apr 18, 2005 11:08 am
by doodlemunch
how do i center an image in a window?!!? wen i resize the win i want the imaage to stay in the center no matter of the window size! im using a container gadget for placing the image inside so i can move the image but i dont know how to make the conversion i mean i get the win height and width but i dont know how to compare them in order to always get my image in the centr of the window how can i do this ?!?

Posted: Mon Apr 18, 2005 2:03 pm
by ebs
doodlemunch,

If I understand you correctly, you can center the image in the window by moving the container to:

ContainerX = (WindowWidth - ContainerWidth)/2
ContainerY = (WindowHeight - ContainerHeight)/2

Regards,
Eric