前面我们介绍了如何使用 Spire.Presentation 添加或删除PowerPoint常规图形到幻灯片,该文将详细介绍如何使用C#添加圆角矩形到幻灯片并设置圆角矩形的半径。
C#
using Spire.Presentation;
using Spire.Presentation.Drawing;
using System.Drawing;
namespace RoundRectangle
{
    class Program
    {
        static void Main(string[] args)
        {          
            Presentation presentation = new Presentation();
            //插入圆角矩形并设置其半径
            presentation.Slides[0].Shapes.InsertRoundRectangle(0, 60, 90, 100, 200, 36);
            //添加圆角矩形并设置其半径
            IAutoShape shape = presentation.Slides[0].Shapes.AppendRoundRectangle(260, 90, 100, 200, 80);
            //设置圆角矩形的填充颜色
            shape.Fill.FillType = FillFormatType.Solid;
            shape.Fill.SolidColor.Color = Color.SeaGreen;
            shape.ShapeStyle.LineColor.Color = Color.White;
            //旋转90度
            shape.Rotation = 90;  
            
            //保存文档    
            presentation.SaveToFile("Result.pptx", FileFormat.Pptx2013);
                                                                              
        }
    }
}VB.NET
Imports Spire.Presentation
Imports Spire.Presentation.Drawing
Imports System.Drawing
Namespace RoundRectangle
	Class Program
		Private Shared Sub Main(args As String())
			Dim presentation As New Presentation()
			'插入圆角矩形并设置其半径 presentation.Slides(0).Shapes.InsertRoundRectangle(0,60,90,100,200,36) '添加圆角矩形并设置其半径
			Dim shape As IAutoShape = presentation.Slides(0).Shapes.AppendRoundRectangle(260, 90, 100, 200, 80)
			'设置圆角矩形的填充颜色 shape.Fill.FillType = FillFormatType.Solid shape.Fill.SolidColor.Color = Color.SeaGreen shape.ShapeStyle.LineColor.Color = Color.White '旋转90度
			shape.Rotation = 90
			'保存文档 presentation.SaveToFile("Result.pptx",FileFormat.Pptx2013) End Sub End Class End Namespace效果图:

 



 
					



