Table of contents
TOC
折叠目录
展开目录

FillFormat.GradientStyle 属性 (发布服务器)FillFormat.GradientStyle Property (Publisher)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

返回一个MsoGradientStyle常量,该常量表示指定填充的渐变样式。只读的。Returns an MsoGradientStyle constant indicating the gradient style for the specified fill. Read-only.

语法Syntax

表达式GradientStyleexpression. GradientStyle

表示对象的 _expression_A 变量。_expression_A variable that represents a FillFormat object.

返回值Return Value

MsoGradientStyleMsoGradientStyle

注解Remarks

属性只读TwoColorGradient方法用于设置填充的渐变样式。Use the OneColorGradient, PresetGradient, or TwoColorGradient method to set the gradient style for the fill.

试图为没有过渡的填充返回该属性将产生错误。使用Type属性确定填充是否具有渐变。Attempting to return this property for a fill that doesn't have a gradient generates an error. Use the Type property to determine whether the fill has a gradient.

GradientStyle属性值可以是一种 * * MsoGradientStyle* * 的 Microsoft Office 类型库中声明常量。The GradientStyle property value can be one of the ** MsoGradientStyle** constants declared in the Microsoft Office type library.

示例Example

本示例向当前出版物添加一个矩形,并将该矩形的填充渐变样式设置为与名为 rect1 的形状的填充渐变样式相同。为了使本示例生效,rect1 必须具有渐变填充。This example adds a rectangle to the active publication and sets its fill gradient style to match that of the shape named rect1. For the example to work, rect1 must have a gradient fill.

Dim intStyle As Integer 

With ActiveDocument.Pages(1).Shapes 
 ' Store gradient style of rect1. 
 intStyle = .Item("rect1").Fill.GradientStyle 
 ' Add new rectangle. 
 With .AddShape(Type:=msoShapeRectangle, _ 
 Left:=0, Top:=0, Width:=40, Height:=80).Fill 
 ' Set color and gradient of new rectangle. 
 .ForeColor.RGB = RGB(128, 0, 0) 
 .OneColorGradient Style:=intStyle, _ 
 Variant:=1, Degree:=1 
 End With 
End With 
© 2018 Microsoft