Add a round corner rectangle to presentation slide in C#

2019-08-13 08:08:48 Written by  support iceblue
Rate this item
(0 votes)

With the help of Spire.Presentation, we can add shapes to the presentation slides easily. This example shows you how to add a round corner rectangle to presentation slide and set the radius of the round corner rectangle in C#.

using Spire.Presentation;
using Spire.Presentation.Drawing;
using System.Drawing;

namespace RoundRectangle
{
    class Program
    {
        static void Main(string[] args)
        {          
            Presentation presentation = new Presentation();

            //Insert a round corner rectangle and set its radious
            presentation.Slides[0].Shapes.InsertRoundRectangle(0, 60, 90, 100, 200, 36);

            //Append a round corner rectangle and set its radious
            IAutoShape shape = presentation.Slides[0].Shapes.AppendRoundRectangle(260, 90, 100, 200, 80);
            //Set the color and fill style of shape
            shape.Fill.FillType = FillFormatType.Solid;
            shape.Fill.SolidColor.Color = Color.SeaGreen;
            shape.ShapeStyle.LineColor.Color = Color.White;
            //Rotate the shape to 90 degree
            shape.Rotation = 90;  
            
            //Save the document to file    
            presentation.SaveToFile("Result.pptx", FileFormat.Pptx2013);
                                                                              
        }
    }
}

Effective screenshot of the round corner rectangle on presentation slide:

Add a round corner rectangle to presentation slide in C#

Additional Info

  • tutorial_title: Add a round corner rectangle to presentation slide
Last modified on Friday, 24 September 2021 09:19