在PPT中,形状是非常重要的元素。3-D形状,立体多元,给人耳目一新的感觉。在幻灯片中添加3-D效果形状,必然会为PPT的整体效果增色不少。为形状设置三维格式时,可设置棱台,轮廓线,表面效果等。

本篇文章,旨在介绍在使用免费的Spire.Presentation,独立创建Powerpoint文档,添加形状,并设置三维效果。感兴趣的朋友,可以从E-iceblue官网下载免费的Spire.Presentation。下载完成后,请将bin文件夹的.dll添加作为引用。友情提示:使用Spire.Presentation可独立创建powerpoint文档。

需要添加的命名空间:

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

步骤详叙:

步骤一:创建PPT文档。

Presentation presentation = new Presentation();
步骤二:添加形状,设置其位置,大小并填充颜色。
IAutoShape shape1 = presentation.Slides[].Shapes.AppendShape(ShapeType.RightArrow, new RectangleF(, , , ));
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 = ;
Demo1.TopBevel.Width = ;
//设置轮廓线类型,颜色,宽度
Demo1.BevelColorMode = BevelColorType.Contour;
Demo1.ContourColor.KnownColor = KnownColors.LightBlue;
Demo1.ContourWidth = 3.5;

步骤四:再添加一个形状作为对照。

IAutoShape shape2 = presentation.Slides[].Shapes.AppendShape(ShapeType.Pentagon, new RectangleF(, , , ));
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 = ;
Demo2.TopBevel.Width = ;
Demo2.BevelColorMode = BevelColorType.Contour;
Demo2.ContourColor.KnownColor = KnownColors.LawnGreen;
Demo2.ContourWidth = ;

步骤五:保存文档为.pptx,启动查看效果。
presentation.SaveToFile("result.pptx", FileFormat.Pptx2010);
System.Diagnostics.Process.Start("result.pptx");

效果截图:

完整代码:

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[].Shapes.AppendShape(ShapeType.RightArrow, new RectangleF(, , , ));
            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 = ;
            Demo1.TopBevel.Width = ;
            Demo1.BevelColorMode = BevelColorType.Contour;
            Demo1.ContourColor.KnownColor = KnownColors.LightBlue;
            Demo1.ContourWidth = 3.5;             IAutoShape shape2 = presentation.Slides[].Shapes.AppendShape(ShapeType.Pentagon, new RectangleF(, , , ));
            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 = ;
            Demo2.TopBevel.Width = ;
            Demo2.BevelColorMode = BevelColorType.Contour;
            Demo2.ContourColor.KnownColor = KnownColors.LawnGreen;
            Demo2.ContourWidth = ;             presentation.SaveToFile("result.pptx", FileFormat.Pptx2010);
            System.Diagnostics.Process.Start("result.pptx");
        }
    }
}

感谢阅读,如有疑问,请留言。

最新文章

  1. three.js自定义形状
  2. web app响应式字体设置!rem之我见
  3. 在Eclipse下搭建Android开发环境教程
  4. myeclipse+tomcat 工程名改名的问题 ——————完美解决方案
  5. 【8.0、9.0c】树形列表 列标题 不对齐的问题及解决方案
  6. php include require
  7. 转:python webdriver API 之设置等待时间
  8. LoadCursor 函数
  9. iOS通过http post上传图片 (转)
  10. javaweb学习总结(四十三)——Filter高级开发
  11. SSH框架整合--applicationContext.xml文件配置实例
  12. Spring声明式事务总结
  13. [Swift]LeetCode563. 二叉树的坡度 | Binary Tree Tilt
  14. 广州.NET微软技术俱乐部与其他技术群的区别
  15. python turtle库
  16. Intellij IDEA快捷键与使用技巧一览表
  17. Learning to rank的讲解,单文档方法(Pointwise),文档对方法(Pairwise),文档列表方法(Listwise)
  18. IE7及以下浏览器不支持json的解决方法
  19. 学习笔记30—Windows那些事
  20. Linux 辅助命令

热门文章

  1. jsp页面 如何通过el表达式获取request属性值
  2. Python 爬虫5——爬取并下载网页指定规格的图片
  3. 启动项目的时候报驱动错误: not support oracle driver 1.0
  4. js将数字转成大写中文
  5. Windows Server 2012 支持的逻辑盘容量最大是多少?
  6. 走向面试之数据库基础:一、你必知必会的SQL语句练习-Part 1
  7. [.net 面向对象程序设计进阶] (25) 团队开发利器(四)分布式版本控制系统Git——使用GitStack+TortoiseGit 图形界面搭建Git环境
  8. MySQL InnoDB存储引擎
  9. Ubuntu 14 安装 .Net Core
  10. 《Entity Framework 6 Recipes》中文翻译系列 (8) -----第二章 实体数据建模基础之继承关系映射TPT