Center segmented control object

I have a segmented control object in a container control. after resizing the container control my segmented control is offset, can’t find a way to center it.
how can I center the segmented control object ?

If you want to recenter it, when app running
put this line in event handler (resiszing) of your container control

SegmentedControl.Left = ContainerControl.Width/2-SegmentedControl.Width/2

Put YOUR control name instead

You can also lock the segmented control on both sides, so it will keep centered, but it will also grow as you enlarge the ContainerControl.

thanks all,

works beautifully, but the code had to go in the ‘resized’ event, than it was working.