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

Everything else that doesn't fall into one of the other PB categories.
doodlemunch
Enthusiast
Enthusiast
Posts: 237
Joined: Tue Apr 05, 2005 11:20 pm

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

Post 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 ?!?
ebs
Enthusiast
Enthusiast
Posts: 561
Joined: Fri Apr 25, 2003 11:08 pm

Post 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
Post Reply