Matrix.Scale メソッド

定義

スケール ベクターを前に付加することで、指定したスケール ベクターをこの Matrix に適用します。

オーバーロード

Scale(Single, Single)

スケール ベクターを前に付加することで、指定したスケール ベクターをこの Matrix に適用します。

Scale(Single, Single, MatrixOrder)

指定した順序を使用して、指定したスケール ベクター (scaleXscaleY) をこの Matrix に適用します。

Scale(Single, Single)

スケール ベクターを前に付加することで、指定したスケール ベクターをこの Matrix に適用します。

public:
 void Scale(float scaleX, float scaleY);
public void Scale (float scaleX, float scaleY);
member this.Scale : single * single -> unit
Public Sub Scale (scaleX As Single, scaleY As Single)

パラメーター

scaleX
Single

この Matrix を x 軸方向にスケールする値。

scaleY
Single

この Matrix を y 軸方向にスケールする値。

例については、「Scale(Single, Single, MatrixOrder)」を参照してください。

適用対象

Scale(Single, Single, MatrixOrder)

指定した順序を使用して、指定したスケール ベクター (scaleXscaleY) をこの Matrix に適用します。

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

パラメーター

scaleX
Single

この Matrix を x 軸方向にスケールする値。

scaleY
Single

この Matrix を y 軸方向にスケールする値。

order
MatrixOrder

この Matrix にスケール ベクターを適用する順序 (前後どちらに付加するか) を指定する MatrixOrder

次のコード例は、Windows フォームで使用するように設計されており、イベント オブジェクトがPaint必要PaintEventArgseです。 コードは、次のアクションを実行します。

  • スケーリング変換 (青い四角形) を適用する前に、画面に四角形を描画します。

  • 行列を作成し、x 軸に 3、y 軸に 2 ずつスケーリングします。

  • このマトリックス変換を四角形に適用します。

  • 変換された四角形を画面 (赤い四角形) に描画します。

赤い四角形は、四角形の左上隅 (四角形の始点) を含め、x 軸では 3、y 軸では 2 の係数でスケーリングされていることに注意してください。

public:
   void ScaleExample( PaintEventArgs^ e )
   {
      Pen^ myPen = gcnew Pen( Color::Blue,1.0f );
      Pen^ myPen2 = gcnew Pen( Color::Red,1.0f );

      // Draw the rectangle to the screen before applying the
      // transform.
      e->Graphics->DrawRectangle( myPen, 50, 50, 100, 100 );

      // Create a matrix and scale it.
      Matrix^ myMatrix = gcnew Matrix;
      myMatrix->Scale( 3, 2, MatrixOrder::Append );

      // Draw the rectangle to the screen again after applying the
      // transform.
      e->Graphics->Transform = myMatrix;
      e->Graphics->DrawRectangle( myPen2, 50, 50, 100, 100 );
   }
public void ScaleExample(PaintEventArgs e)
{
    Pen myPen = new Pen(Color.Blue, 1);
    Pen myPen2 = new Pen(Color.Red, 1);
             
    // Draw the rectangle to the screen before applying the
    // transform.
    e.Graphics.DrawRectangle(myPen, 50, 50, 100, 100);
             
    // Create a matrix and scale it.
    Matrix myMatrix = new Matrix();
    myMatrix.Scale(3, 2, MatrixOrder.Append);
             
    // Draw the rectangle to the screen again after applying the
    // transform.
    e.Graphics.Transform = myMatrix;
    e.Graphics.DrawRectangle(myPen2, 50, 50, 100, 100);
}
Public Sub ScaleExample(ByVal e As PaintEventArgs)
    Dim myPen As New Pen(Color.Blue, 1)
    Dim myPen2 As New Pen(Color.Red, 1)

    ' Draw the rectangle to the screen before applying the
    ' transform.
    e.Graphics.DrawRectangle(myPen, 50, 50, 100, 100)

    ' Create a matrix and scale it.
    Dim myMatrix As New Matrix
    myMatrix.Scale(3, 2, MatrixOrder.Append)

    ' Draw the rectangle to the screen again after applying the
    ' transform.
    e.Graphics.Transform = myMatrix
    e.Graphics.DrawRectangle(myPen2, 50, 50, 100, 100)
End Sub

適用対象