GetEffective

FillFormat.GetEffective 方法

获取应用继承的有效填充格式数据。

public IFillFormatEffectiveData GetEffective()

返回值

一个 IFillFormatEffectiveData

示例

本示例演示如何获取形状的有效填充格式属性。

[C#]
using (Presentation pres = new Presentation(@"MyPresentation.pptx"))
{
	IFillFormatEffectiveData effectiveFillFormat = pres.Slides[0].Shapes[0].FillFormat.GetEffective();

	Console.WriteLine("类型: " + effectiveFillFormat.FillType);
	switch (effectiveFillFormat.FillType)
	{
		case FillType.Solid:
			Console.WriteLine("填充颜色: " + effectiveFillFormat.SolidFillColor);
			break;
		case FillType.Pattern:
			Console.WriteLine("图案样式: " + effectiveFillFormat.PatternFormat.PatternStyle);
			Console.WriteLine("前景色: " + effectiveFillFormat.PatternFormat.ForeColor);
			Console.WriteLine("背景色: " + effectiveFillFormat.PatternFormat.BackColor);
			break;
		case FillType.Gradient:
			Console.WriteLine("渐变方向: " + effectiveFillFormat.GradientFormat.GradientDirection);
			Console.WriteLine("渐变停顿数: " + effectiveFillFormat.GradientFormat.GradientStops.Count);
			break;
		case FillType.Picture:
			Console.WriteLine("图片宽度: " + effectiveFillFormat.PictureFillFormat.Picture.Image.Width);
			Console.WriteLine("图片高度: " + effectiveFillFormat.PictureFillFormat.Picture.Image.Height);
			break;
	}
}

另请参阅