Pattern

Fill.Pattern property

获得PatternType用于填充。

public PatternType Pattern { get; }

例子

展示如何设置形状的图案。

Document doc = new Document(MyDir + "Shape stroke pattern border.docx");

Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
Fill fill = shape.Fill;

Console.WriteLine("Pattern value is: {0}", fill.Pattern);

// 有几种方法可以指定填充图案。
// 1 - 将图案应用于形状填充:
fill.Patterned(PatternType.DiagonalBrick);

// 2 - 将前景色和背景色的图案应用于形状填充:
fill.Patterned(PatternType.DiagonalBrick, Color.Aqua, Color.Bisque);

doc.Save(ArtifactsDir + "Shape.FillPattern.docx");

也可以看看