Share via


Publisher) (FillFormat.GradientVariant 屬性

會傳回 Long 指出指定的填滿的漸層變化。 一般而言,值為 1 到 4 大部分的漸層填滿的整數。 如果漸層樣式為 msoGradientFromTitlemsoGradientFromCenter ,則此屬性會傳回 1 或 2。

此屬性的值會對應到 填滿效果] 對話方塊中 [ 漸層] 索引標籤上的漸層變化 (按從左到右和從上到下的順序編號)。 唯讀。

語法

運算式GradientVariant

表達 代表 FillFormat 物件的 變數。

傳回值

Long

註解

使用 OneColorGradientPresetGradientTwoColorGradient 方法可設定填滿的漸層變化。

範例

本範例在目前出版物中新增一個矩形,並將其填滿設為與 rect1 圖案一樣的漸層變化。 為使本範例能正常執行,rect1 必須有漸層填滿設定。

Dim intVariant As Integer 
 
With ActiveDocument.Pages(1).Shapes 
 ' Store gradient variant of rect1. 
 intVariant = .Item("rect1").Fill.GradientVariant 
 ' 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:=msoGradientHorizontal, _ 
 Variant:=intVariant, Degree:=1 
 End With 
End With 

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應