Set the outline and effects for shapes in PowerPoint files via Spire.Presentation

2015-03-19 08:05:12 Written by  support iceblue
Rate this item
(0 votes)

Outline and effects for shapes can make the presentation of your PowerPoint files more attractive. This article talks about how to set the outline and effects for shapes via Spire.Presentation.

Step 1: Create a PowerPoint document.

Presentation ppt = new Presentation();

Step 2: Get the first slide

ISlide slide = ppt.Slides[0];

Step 3: Draw Rectangle shape on slide[0] with methord AppendShape();

IAutoShape shape = slide.Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 100, 100, 50));

Step 4: Set outline color as red.

//Outline color
shape.ShapeStyle.LineColor.Color = Color.Red;

Step 5: Add shadow effect and set parameters for it.

//Effect
PresetShadow shadow = new PresetShadow();
shadow.Preset = PresetShadowValue.FrontRightPerspective;
shadow.Distance = 10.0;
shadow.Direction = 225.0f;
shape.EffectDag.PresetShadowEffect = shadow;

Step 6: Change a Ellipse to add yellow outline with a glow effect:

Change step 4 and 5 as Code:

shape = slide.Shapes.AppendShape(ShapeType.Ellipse, new RectangleF(200, 100, 100, 100));
//Outline color
shape.ShapeStyle.LineColor.Color = Color.Yellow;
//Effect
GlowEffect glow = new GlowEffect();
glow.ColorFormat.Color = Color.Purple;
glow.Radius = 20.0;
shape.EffectDag.GlowEffect = glow;

Step 7: Save and review.

ppt.SaveToFile("Result.pptx", FileFormat.Pptx2010);
System.Diagnostics.Process.Start("Sample.PPTx");

Here is the screen shot:

Set the outline and effects for shapes in PowerPoint files via Spire.Presentation

Additional Info

  • tutorial_title: Set the outline and effects for shapes
Last modified on Friday, 24 September 2021 09:20