다음을 통해 공유


PathGradientBrush.ScaleTransform 메서드

정의

지정된 배율만큼 로컬 기하학적 변환의 배율을 조정합니다. 이 메서드는 변환 앞에 배율 조정 매트릭스를 추가합니다.

오버로드

ScaleTransform(Single, Single)

지정된 배율만큼 로컬 기하학적 변환의 배율을 조정합니다. 이 메서드는 변환 앞에 배율 조정 매트릭스를 추가합니다.

ScaleTransform(Single, Single, MatrixOrder)

특정 순서로 지정된 배율만큼 로컬 기하학적 변환의 배율을 조정합니다.

ScaleTransform(Single, Single)

Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs

지정된 배율만큼 로컬 기하학적 변환의 배율을 조정합니다. 이 메서드는 변환 앞에 배율 조정 매트릭스를 추가합니다.

public:
 void ScaleTransform(float sx, float sy);
public void ScaleTransform (float sx, float sy);
member this.ScaleTransform : single * single -> unit
Public Sub ScaleTransform (sx As Single, sy As Single)

매개 변수

sx
Single

X축 방향의 변환 배율 인수입니다.

sy
Single

Y축 방향의 변환 배율 인수입니다.

예제

예제를 보려면 ScaleTransform를 참조하세요.

적용 대상

ScaleTransform(Single, Single, MatrixOrder)

Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs

특정 순서로 지정된 배율만큼 로컬 기하학적 변환의 배율을 조정합니다.

public:
 void ScaleTransform(float sx, float sy, System::Drawing::Drawing2D::MatrixOrder order);
public void ScaleTransform (float sx, float sy, System.Drawing.Drawing2D.MatrixOrder order);
member this.ScaleTransform : single * single * System.Drawing.Drawing2D.MatrixOrder -> unit
Public Sub ScaleTransform (sx As Single, sy As Single, order As MatrixOrder)

매개 변수

sx
Single

X축 방향의 변환 배율 인수입니다.

sy
Single

Y축 방향의 변환 배율 인수입니다.

order
MatrixOrder

크기 조정 매트릭스를 앞에 추가할 것인지 아니면 뒤에 추가할 것인지를 지정하는 MatrixOrder입니다.

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 개체인 가 OnPaint 필요합니다PaintEventArgse. 코드

  • 그래픽 경로를 만들고 사각형을 추가합니다.

  • 경로 지점에서 을 PathGradientBrush 만듭니다(이 예제에서는 점이 사각형을 형성하지만 대부분의 셰이프일 수 있음).

  • 가운데 색을 빨간색으로 설정하고 주변 색을 파란색으로 설정합니다.

  • PathGradientBrush 배율 변환을 적용하기 전에 를 화면에 그립니다.

  • 해당 메서드를 사용하여 브러시에 배율 변환을 적용합니다 ScaleTransform .

  • 메서드를 TranslateTransform 호출하여 이전에 화면에 그려진 브러시 사각형을 오버레이하지 않도록 브러시 사각형을 이동합니다.

  • 변환된 브러시 사각형을 화면에 그립니다.

아래쪽 사각형은 x축에서 변환 전에 그린 사각형보다 두 배 더 깁니다.

public:
   void ScaleTransformExample( PaintEventArgs^ e )
   {
      // Create a graphics path and add a rectangle.
      GraphicsPath^ myPath = gcnew GraphicsPath;
      Rectangle rect = Rectangle(100,20,100,50);
      myPath->AddRectangle( rect );

      // Get the path's array of points.
      array<PointF>^myPathPointArray = myPath->PathPoints;

      // Create a path gradient brush.
      PathGradientBrush^ myPGBrush = gcnew PathGradientBrush( myPathPointArray );

      // Set the color span.
      myPGBrush->CenterColor = Color::Red;
      array<Color>^ mySurroundColor = {Color::Blue};
      myPGBrush->SurroundColors = mySurroundColor;

      // Draw the brush to the screen prior to transformation.
      e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 );

      // Scale by a factor of 2 in the x-axis by applying the scale
      // transform to the brush.
      myPGBrush->ScaleTransform( 2, 1, MatrixOrder::Append );

      // Move the brush down by 100 by Applying the translate
      // transform to the brush.
      myPGBrush->TranslateTransform(  -100, 100, MatrixOrder::Append );

      // Draw the brush to the screen again after applying the
      // transforms.
      e->Graphics->FillRectangle( myPGBrush, 10, 10, 300, 300 );
   }
public void ScaleTransformExample(PaintEventArgs e)
{
             
    // Create a graphics path and add a rectangle.
    GraphicsPath myPath = new GraphicsPath();
    Rectangle rect = new Rectangle(100, 20, 100, 50);
    myPath.AddRectangle(rect);
             
    // Get the path's array of points.
    PointF[] myPathPointArray = myPath.PathPoints;
             
    // Create a path gradient brush.
    PathGradientBrush myPGBrush = new
        PathGradientBrush(myPathPointArray);
             
    // Set the color span.
    myPGBrush.CenterColor = Color.Red;
    Color[] mySurroundColor = {Color.Blue};
    myPGBrush.SurroundColors = mySurroundColor;
             
    // Draw the brush to the screen prior to transformation.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200);
             
    // Scale by a factor of 2 in the x-axis by applying the scale
    // transform to the brush.
    myPGBrush.ScaleTransform(2, 1, MatrixOrder.Append);
             
    // Move the brush down by 100 by Applying the translate
    // transform to the brush.
    myPGBrush.TranslateTransform(-100, 100, MatrixOrder.Append);
             
    // Draw the brush to the screen again after applying the
    // transforms.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 300, 300);
}
Public Sub ScaleTransformExample(ByVal e As PaintEventArgs)

    ' Create a graphics path and add a rectangle.
    Dim myPath As New GraphicsPath
    Dim rect As New Rectangle(100, 20, 100, 50)
    myPath.AddRectangle(rect)

    ' Get the path's array of points.
    Dim myPathPointArray As PointF() = myPath.PathPoints

    ' Create a path gradient brush.
    Dim myPGBrush As New PathGradientBrush(myPathPointArray)

    ' Set the color span.
    myPGBrush.CenterColor = Color.Red
    Dim mySurroundColor As Color() = {Color.Blue}
    myPGBrush.SurroundColors = mySurroundColor

    ' Draw the brush to the screen prior to transformation.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200)

    ' Scale by a factor of 2 in the x-axis by applying the scale
    ' transform to the brush.
    myPGBrush.ScaleTransform(2, 1, MatrixOrder.Append)

    ' Move the brush down by 100 by Applying the translate
    ' transform to the brush.
    myPGBrush.TranslateTransform(-100, 100, MatrixOrder.Append)

    ' Draw the brush to the screen again after applying the
    ' transforms.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 300, 300)
End Sub

적용 대상