共用方式為


SimpleShape.FillGradientStyle 屬性

更新:2007 年 11 月

取得或設定用來填滿形狀的漸層樣式。

命名空間:  Microsoft.VisualBasic.PowerPacks
組件:  Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

語法

<BrowsableAttribute(True)> _
Public Property FillGradientStyle As FillGradientStyle

Dim instance As SimpleShape
Dim value As FillGradientStyle

value = instance.FillGradientStyle

instance.FillGradientStyle = value
[BrowsableAttribute(true)]
public FillGradientStyle FillGradientStyle { get; set; }
[BrowsableAttribute(true)]
public:
property FillGradientStyle FillGradientStyle {
    FillGradientStyle get ();
    void set (FillGradientStyle value);
}
public function get FillGradientStyle () : FillGradientStyle
public function set FillGradientStyle (value : FillGradientStyle)

屬性值

型別:Microsoft.VisualBasic.PowerPacks.FillGradientStyle

FillGradientStyle 列舉型別,決定形狀中所顯示之漸層填滿的類型和方向。

備註

如果 FillStyle 屬性是設定為 Solid 以外的任何值,則不會顯示漸層效果。

當 FillGradientStyle 是設定為 None 時,這個屬性沒有作用。

當 FillGradientStyle 是設定為 CentralFillGradientColor 會決定形狀中心點的色彩。這個色彩會漸變成外框的 FillColor

當 FillGradientStyle 是設定為 HorizontalForwardDiagonal 時,色彩會從左邊的 FillColor 漸變成右邊的 FillGradientColor

當 FillGradientStyle 是設定為 BackwardDiagonal 時,色彩會從左邊的 FillGradientColor 漸變成右邊的 FillColor

當 FillGradientStyle 是設定為 Vertical 時,色彩會從頂端的 FillColor 漸變成底端的 FillGradientColor

範例

下列範例顯示如何使用 FillGradientStyle 屬性變更圖案的外觀。這個範例要求您的表單必須有一個名為 OvalShape1 的 OvalShape 控制項。

Private Sub OvalShape1_Click(ByVal sender As System.Object, _
 ByVal e As System.EventArgs) Handles OvalShape1.Click
    ' Set the fill style.
    OvalShape1.FillStyle = FillStyle.Solid
    ' Set the fill color.
    OvalShape1.FillColor = Color.Red
    ' Set the gradient style.
    OvalShape1.FillGradientStyle = FillGradientStyle.Central
    ' Set the gradient color.
    OvalShape1.FillGradientColor = Color.Purple
End Sub
private void ovalShape1_Click(System.Object sender, System.EventArgs e)
{
    // Set the fill style.
    ovalShape1.FillStyle = FillStyle.Solid;
    // Set the fill color.
    ovalShape1.FillColor = Color.Red;
    // Set the gradient style.
    ovalShape1.FillGradientStyle = FillGradientStyle.Central;
    // Set the gradient color.
    ovalShape1.FillGradientColor = Color.Purple;
}

使用權限

請參閱

參考

SimpleShape 類別

SimpleShape 成員

Microsoft.VisualBasic.PowerPacks 命名空間

其他資源

Line 和 Shape 控制項簡介 (Visual Studio)

HOW TO:使用 LineShape 控制項繪製線條 (Visual Studio)

HOW TO:使用 OvalShape 和 RectangleShape 控制項繪製圖案 (Visual Studio)