How to Align Shapes to the Slide?

I want to change the alignment of a shape with C# code.
I have attached an image of how to do it with the powerpoint gui.
Please let me know if this is possible.

Align Shape.png (35.2 KB)
After Align.png (28.5 KB)

Thank you for posting the query.

You can use SlideUtil class to perform alignment of shapes as shown below:

var slide = presentation.Slides[0];
var shapeIndices = new int[] { 0 };

SlideUtil.AlignShapes(ShapesAlignmentType.AlignCenter, true, slide, shapeIndices);

Documents: Align Shape
API Reference: SlideUtil Class | ShapesAlignmentType Enumeration