Change shape stacking order

Overview

Reorder shapes to change how they overlap on a slide. Move a background element behind content or bring an annotation in front of a picture. You can also change the order of shapes within a group while preserving the group’s structure.

Usage example (C# / .NET)

Install Aspose.Slides for .NET before running this standalone example.

This C# example creates overlapping red and blue rectangles, then brings the red rectangle to the front. Reordering changes their overlap while leaving their bounds unchanged.

using System.Drawing;
using Aspose.Slides;
using Aspose.Slides.Export;

using var presentation = new Presentation();
var shapes = presentation.Slides[0].Shapes;
var red = shapes.AddAutoShape(ShapeType.Rectangle, 60, 60, 220, 150);
red.Name = "Red";
red.FillFormat.FillType = FillType.Solid;
red.FillFormat.SolidFillColor.Color = Color.Red;
var blue = shapes.AddAutoShape(ShapeType.Rectangle, 140, 110, 220, 150);
blue.Name = "Blue";
blue.FillFormat.FillType = FillType.Solid;
blue.FillFormat.SolidFillColor.Color = Color.Blue;
shapes.Reorder(shapes.Count - 1, red);
presentation.Save("shape-order.pptx", SaveFormat.Pptx);

The red rectangle moves in front of the blue rectangle while both keep their positions.

Moving the red rectangle to the last index puts it in front. Both shapes keep their positions.

FAQ

Does changing stacking order move the shape?

It changes the drawing order. The shape’s position and size can stay the same.

How can I bring a shape to the front?

Move it to the end of its containing shape collection. Shapes later in the collection are drawn in front of earlier shapes in that same collection.

How does stacking order work for shapes inside a group?

Reorder a child within the group’s shape collection to change its overlap with siblings. Move the group itself in the slide collection to change its position relative to shapes outside the group.

Guides

Related feature: Group shapes.

All features