PathGradientBrush.ScaleTransform メソッド

定義

指定した分量だけローカル ジオメトリック変換をスケールします。 このメソッドは変換の前にスケーリング行列を適用します。

オーバーロード

ScaleTransform(Single, Single)

指定した分量だけローカル ジオメトリック変換をスケールします。 このメソッドは変換の前にスケーリング行列を適用します。

ScaleTransform(Single, Single, MatrixOrder)

指定した順序で、指定した分量だけローカル ジオメトリック変換をスケールします。

ScaleTransform(Single, Single)

ソース:
PathGradientBrush.cs
ソース:
PathGradientBrush.cs
ソース:
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)

ソース:
PathGradientBrush.cs
ソース:
PathGradientBrush.cs
ソース:
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 フォームで使用するように設計されており、イベント オブジェクトがOnPaint必要PaintEventArgseです。 コード

  • グラフィックス パスを作成し、四角形を追加します。

  • PathGradientBrushパスポイントから を作成します (この例では、ポイントは四角形を形成しますが、ほとんどの図形である可能性があります)。

  • 中心の色を赤に設定し、周囲の色を青に設定します。

  • スケール変換を PathGradientBrush 適用する前に、 を画面に描画します。

  • メソッドを使用して、スケール変換をブラシに ScaleTransform 適用します。

  • メソッドを TranslateTransform 呼び出して、前に画面に描画されたものをオーバーレイしないようにブラシの四角形を移動します。

  • 翻訳されたブラシの四角形を画面に描画します。

下の四角形は x 軸の 2 倍の長さであり、平行移動の前に描画された四角形の長さであることがわかります。

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

適用対象