In ppt, the shape is a very important element. D-shape, three-dimensional diversity, giving people a refreshing feeling. Adding the effect shape to the slideshow will certainly add a lot to the overall effect of the PPT. When you set a three-dimensional format for a shape, you can set the bevel, contour, surface effect, and so on.
This article is intended to introduce the use of free spire.presentation, create a PowerPoint document independently, add shapes, and set three-dimensional effects. Interested friends, can download the free spire.presentation from E-iceblue official website. When the download is complete, add the. dll of the Bin folder as a reference. Friendly tip: Use Spire.presentation to create PowerPoint documents independently.
Namespaces that need to be added:
using Spire.Presentation;using Spire.Presentation.Drawing;using System.Drawing;
Details of the steps:
Step One: Create a ppt document.
Presentation presentation = new Presentation();
Step Two: Add the shape, set its position, size, and fill the color.
iautoshape shape1 = Presentation [0 ] (Shapetype, New RectangleF (150 , 150 , Span class= "Hljs-number" >150 , 150 )) Shape1 = Fillformattype Shape1 = Knowncolors
Step Three: set the three-dimensional effect for the shape.
Shapethreed Demo1 = Shape1. ThreeD. Shapethreed;Setting the surface effect Demo1. PresetMaterial= Presetmaterialtype. Matte;Set bevel type, height and width Demo1. Topbevel. Presettype= Bevelpresettype. ArtDeco;Demo1. Topbevel. Height=4;Demo1. Topbevel. Width= A;Set contour line type, color, Width Demo1. Bevelcolormode= Bevelcolortype. Contour;Demo1. Contourcolor. KnownColor= Knowncolors. LightBlue;Demo1. Contourwidth=3.5;
Step Four: add another shape as a control.
Iautoshape Shape2 = Presentation. Slides[0]. Shapes. Appendshape(ShapeType. Pentagon, New RectangleF ( -, Max, Max, Max));Shape2. Fill. Filltype= Fillformattype. Solid;Shape2. Fill. Solidcolor. KnownColor= Knowncolors. Lawngreen;Shapethreed Demo2 = Shape2. ThreeD. Shapethreed;Demo2. PresetMaterial= Presetmaterialtype. Softedge;Demo2. Topbevel. Presettype= Bevelpresettype. Softround;Demo2. Topbevel. Height= A;Demo2. Topbevel. Width= A;Demo2. Bevelcolormode= Bevelcolortype. Contour;Demo2. Contourcolor. KnownColor= Knowncolors. Lawngreen;Demo2. Contourwidth=5;
Step Five: save the document as. pptx to start the viewing effect.
presentation.SaveToFile("result.pptx", FileFormat.Pptx2010);System.Diagnostics.Process.Start("result.pptx");
Effect:
Full code:
Using System;Using System. Collections. Generic;Using System. Linq;Using System. Text;Using Spire. Presentation;Using Spire. Presentation. Drawing;Using System. Drawing;Namespace test{class Program {static void Main (string[] args) {Presentation Presentation = new Presentation ();Iautoshape Shape1 = Presentation. Slides[0]. Shapes. Appendshape(ShapeType. RightArrow, New RectangleF ( Max, Max, Max, Max));Shape1. Fill. Filltype= Fillformattype. Solid;Shape1. Fill. Solidcolor. KnownColor= Knowncolors. Royalblue;Shapethreed Demo1 = Shape1. ThreeD. Shapethreed;Demo1. PresetMaterial= Presetmaterialtype. Matte;Demo1. Topbevel. Presettype= Bevelpresettype. ArtDeco;Demo1. Topbevel. Height=4;Demo1. Topbevel. Width= A;Demo1. Bevelcolormode= Bevelcolortype. Contour;Demo1. Contourcolor. KnownColor= Knowncolors. LightBlue;Demo1. Contourwidth=3.5;Iautoshape Shape2 = Presentation. Slides[0]. Shapes. Appendshape(ShapeType. Pentagon, New RectangleF ( -, Max, Max, Max));Shape2. Fill. Filltype= Fillformattype. Solid;Shape2. Fill. Solidcolor. KnownColor= Knowncolors. Lawngreen;Shapethreed Demo2 = Shape2. ThreeD. Shapethreed;Demo2. PresetMaterial= Presetmaterialtype. Softedge;Demo2. Topbevel. Presettype= Bevelpresettype. Softround;Demo2. Topbevel. Height= A;Demo2. Topbevel. Width= A;Demo2. Bevelcolormode= Bevelcolortype. Contour;Demo2. Contourcolor. KnownColor= Knowncolors. Lawngreen;Demo2. Contourwidth=5;Presentation. SaveToFile("Result.pptx", FileFormat. Pptx2010);System. Diagnostics. Process. Start("Result.pptx");} }}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
C # PPT sets three-dimensional effects for shapes