다음을 통해 공유


GradientBrush.SpreadMethod 속성

정의

색칠하는 개체 경계 내부에서 시작하거나 끝나는 그라데이션을 그리는 방법을 지정하는 칠하기 방법 형식을 가져오거나 설정합니다.

public:
 property System::Windows::Media::GradientSpreadMethod SpreadMethod { System::Windows::Media::GradientSpreadMethod get(); void set(System::Windows::Media::GradientSpreadMethod value); };
public System.Windows.Media.GradientSpreadMethod SpreadMethod { get; set; }
member this.SpreadMethod : System.Windows.Media.GradientSpreadMethod with get, set
Public Property SpreadMethod As GradientSpreadMethod

속성 값

GradientSpreadMethod

그라데이션을 그리는 데 사용되는 칠하기 방법의 형식입니다. 기본값은 Pad입니다.

예제

다음 예제에서는 다른 적용 SpreadMethod 설정을 여러 LinearGradientBrushRadialGradientBrush 개체입니다.

<Page 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
  Title="Gradient Spread Methods">
  <StackPanel>

    <!-- The following three examples show the different gradient spread methods
         applied to linear gradient brushes. -->
    <Rectangle Width="150" Height="75" Stroke="Black">
      <Rectangle.Fill>

        <!-- Pad -->
        <LinearGradientBrush StartPoint="0.3,0.5" EndPoint="0.7,0.5" SpreadMethod="Pad">
          <GradientStop Color="White" Offset="0" />
          <GradientStop Color="#333333" Offset="1" />
        </LinearGradientBrush>
      </Rectangle.Fill>
    </Rectangle>

    <Rectangle Width="150" Height="75" Stroke="Black">
      <Rectangle.Fill>

        <!-- Reflect -->
        <LinearGradientBrush StartPoint="0.3,0.5" EndPoint="0.7,0.5" SpreadMethod="Reflect">
          <GradientStop Color="White" Offset="0" />
          <GradientStop Color="#333333" Offset="1" />
        </LinearGradientBrush>
      </Rectangle.Fill>
    </Rectangle>

    <Rectangle Width="150" Height="75" Stroke="Black">
      <Rectangle.Fill>

        <!-- Repeat -->
        <LinearGradientBrush StartPoint="0.3,0.5" EndPoint="0.7,0.5" SpreadMethod="Repeat">
          <GradientStop Color="White" Offset="0" />
          <GradientStop Color="#333333" Offset="1" />
        </LinearGradientBrush>
      </Rectangle.Fill>
    </Rectangle>

    <!-- The following three examples show the different gradient spread methods
         applied to radial gradient brushes. -->
    <Rectangle Width="150" Height="75" Stroke="Black">
      <Rectangle.Fill>

        <!-- Pad -->
        <RadialGradientBrush Center="0.5,0.5" RadiusX="0.3" RadiusY="0.3" SpreadMethod="Pad">
          <GradientStop Color="White" Offset="0" />
          <GradientStop Color="#333333" Offset="1" />
        </RadialGradientBrush>
      </Rectangle.Fill>
    </Rectangle>

    <Rectangle Width="150" Height="75" Stroke="Black">
      <Rectangle.Fill>

        <!-- Reflect -->
        <RadialGradientBrush Center="0.5,0.5" RadiusX="0.3" RadiusY="0.3" SpreadMethod="Reflect">
          <GradientStop Color="White" Offset="0" />
          <GradientStop Color="#333333" Offset="1" />
        </RadialGradientBrush>
      </Rectangle.Fill>
    </Rectangle>

    <Rectangle Width="150" Height="75" Stroke="Black">
      <Rectangle.Fill>

        <!-- Repeat -->
        <RadialGradientBrush Center="0.5,0.5" RadiusX="0.3" RadiusY="0.3" SpreadMethod="Repeat">
          <GradientStop Color="White" Offset="0" />
          <GradientStop Color="#333333" Offset="1" />
        </RadialGradientBrush>
      </Rectangle.Fill>
    </Rectangle>

  </StackPanel>
</Page>

설명

다음 그림에서 사용 가능한 spread 방법과 그 효과 나와 LinearGradientBrushRadialGradientBrush입니다. 빨간색 선은 그라데이션 공간을 나타냅니다. A LinearGradientBrush 그라데이션 해당 공간을 사용 하 여 정의 해당 StartPointEndPoint 속성입니다. A RadialGradientBrush 그라데이션 해당 공간을 사용 하 여 정의 해당 CenterRadiusX, 및 RadiusY 속성입니다.

다양한 GradientSpread 설정
그라데이션 확산 메서드

종속성 속성 정보

식별자 필드 SpreadMethodProperty
메타 데이터 속성 설정 true 없음

적용 대상

추가 정보