共用方式為


GradientStop.Color 屬性

定義

取得或設定漸層停駐點的色彩。

public:
 property Color Color { Color get(); void set(Color value); };
Color Color();

void Color(Color value);
public Color Color { get; set; }
var color = gradientStop.color;
gradientStop.color = color;
Public Property Color As Color
<GradientStop Color="colorString" .../>

屬性值

漸層停駐點的色彩。 預設值為 Transparent

範例

本範例會在隱含GradientStopCollection中建立具有四個漸層停駐點的LinearGradientBrush,用來繪製Rectangle

<StackPanel>
  <!-- This rectangle is painted with a diagonal linear gradient. -->
  <Rectangle Width="200" Height="100">
    <Rectangle.Fill>
      <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
        <GradientStop Color="Yellow" Offset="0.0" />
        <GradientStop Color="Red" Offset="0.25" />
        <GradientStop Color="Blue" Offset="0.75" />
        <GradientStop Color="LimeGreen" Offset="1.0" />
      </LinearGradientBrush>
    </Rectangle.Fill>
  </Rectangle>
</StackPanel>

適用於