다음을 통해 공유


GradientBrush.MappingMode 속성

정의

그라데이션 브러시의 위치 좌표가 절대 좌표인지 아니면 출력 영역을 기준으로 하는지를 지정하는 열거형을 가져오거나 설정합니다 BrushMappingMode .

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

속성 값

BrushMappingMode 그라데이션 브러시의 위치 좌표가 해석되는 방법을 지정하는 값입니다. 기본값은 RelativeToBoundingBox입니다.

예제

다음 예제에서는 속성을 사용하여 MappingMode 그라데이션 및 EndPoint 그라데이션에 사용할 좌표계를 StartPoint 지정하는 방법을 보여줍니다.

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

    <!-- Both of the rectangles below have identical gradients applied but use different
         coordinate systems to specify the StartPoint and EndPoint of the gradient. -->
    <Rectangle Width="200" Height="100" Margin="10">
      <Rectangle.Fill>

        <!-- The MappingMode property is set to "Absolute" which specifies that the coordinate 
             system used for the StartPoint and EndPoint properties is not relative to the 
             Brush output area. Values are interpreted directly in local space (in pixels). -->
        <LinearGradientBrush MappingMode="Absolute" 
            StartPoint="0,50" EndPoint="200,50">
          <GradientStop Color="Yellow" Offset="0" />
          <GradientStop Color="Red" Offset="0.25" />
          <GradientStop Color="Blue" Offset="0.75" />
          <GradientStop Color="LimeGreen" Offset="1" />
        </LinearGradientBrush>
      </Rectangle.Fill>
    </Rectangle>

    <Rectangle Width="200" Height="100" Margin="10">
      <Rectangle.Fill>

        <!-- The MappingMode property is set to "RelativeToBoundingBox" (default) which  
             specifies the coordinate system for the StartPoint and EndPoint are relative to 
             the Brush output area: 0 indicates 0 percent of the output area and 1 indicates 
             100 percent of the output area.  -->
        <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
          <GradientStop Color="Yellow" Offset="0" />
          <GradientStop Color="Red" Offset="0.25" />
          <GradientStop Color="Blue" Offset="0.75" />
          <GradientStop Color="LimeGreen" Offset="1" />
        </LinearGradientBrush>
      </Rectangle.Fill>
    </Rectangle>

  </StackPanel>
</Page>

설명

Absolute 은 그라데이션 브러시의 좌표가 디바이스 독립적 픽셀을 사용하여 표현됨을 나타냅니다.

종속성 속성 정보

Item 가치
식별자 필드 MappingModeProperty
메타데이터 속성이 다음으로 설정됩니다. true 없음

적용 대상