I have a control and a container, the container’s width is specified firstly. After that I add the control to the container. How to tell the container to place the child control at the center horizontally? I want to specify the y value by myself.
I have a control and a container, the container’s width is specified firstly. After
Share
The math for that is:
control.x = (container.width - control.width) / 2If this isn’t what you were looking for, let me know and I’ll try to help!