欢迎来到天天文库
浏览记录
ID:57587610
大小:732.59 KB
页数:5页
时间:2020-08-27
《C#-如何设置PPT文字、图片阴影效果.docx》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、C#设置PPT文字/图片阴影效果我们进行PPT幻灯片编辑时,可以通过设置文字或图片的阴影效果,来使幻灯片内容的呈现效果更为立体化,给人视觉上的立体感。本文将介绍通过C#来设置PPT中文字或图片阴影效果的方法。示例要点:l设置PPT文字阴影效果l设置PPT图片阴影效果工具lFreeSpire.Presentationfor.NET(社区版)安装后,注意在编辑代码时,添加引用Spire.Presentation.dll,dll文件可在安装路径下的Bin文件夹下获取。C#示例代码【示例1】设置PPT文字阴影效果usingSpire.Presentati
2、on;usingSpire.Presentation.Drawing;usingSystem.Drawing;namespaceShadowforText_PPT{classProgram{staticvoidMain(string[]args){//实例化Presentation类的对象,获取第一张幻灯片Presentationpresentation=newPresentation();ISlideslide=presentation.Slides[0];//在幻灯片指定位置绘制指定大小的矩形形状,并设置填形状填充IAutoShapeshap
3、e=slide.Shapes.AppendShape(ShapeType.Rectangle,newRectangleF(10,10,700,520));shape.ShapeStyle.LineColor.Color=Color.White;stringpicPath="gf.png";shape.Fill.FillType=FillFormatType.Picture;shape.Fill.PictureFill.Picture.Url=picPath;shape.Fill.PictureFill.FillType=PictureFillTy
4、pe.Stretch;//shape.Fill.FillType=Spire.Presentation.Drawing.FillFormatType.Picture;//绘制文本内容到形状,并设置文本格式shape.AppendTextFrame(" 江南逢李龟年杜甫岐王宅里寻常见,崔九堂前几度闻。正是江南好风景,落花时节又逢君。");shape.TextFrame.Paragraphs[0].TextRanges[0].LatinFont=newTextFont("隶书");shape.TextFrame.Paragraphs[0]
5、.TextRanges[0].Fill.FillType=FillFormatType.Solid;shape.TextFrame.Paragraphs[0].TextRanges[0].Fill.SolidColor.Color=Color.Black;shape.TextFrame.Paragraphs[0].TextRanges[0].FontHeight=38;//实例化OuterShadowEffect类的对象,设置文字阴影效果Spire.Presentation.Drawing.OuterShadowEffectShadow=newS
6、pire.Presentation.Drawing.OuterShadowEffect();//Spire.Presentation.Drawing.InnerShadowEffectShadow=newSpire.Presentation.Drawing.InnerShadowEffect();Shadow.BlurRadius=0;Shadow.Direction=50;Shadow.Distance=10;Shadow.ColorFormat.Color=Color.Gray;shape.TextFrame.TextRange.Effect
7、Dag.OuterShadowEffect=Shadow;//shape.TextFrame.TextRange.EffectDag.InnerShadowEffect=Shadow;//保存文档并打开presentation.SaveToFile("result.pptx",FileFormat.Pptx2010);System.Diagnostics.Process.Start("result.pptx");}}}PPT文字阴影添加效果:【示例2】设置PPT图片阴影效果usingSpire.Presentation;usingSpire.Pr
8、esentation.Drawing;usingSystem.Drawing;namespaceShadowforImg_PPT{cla
此文档下载收益归作者所有