スケール ベクタを前に付加することで、指定したスケール ベクタをこの Matrix オブジェクトに適用します。
オーバーロードの一覧
スケール ベクタを前に付加することで、指定したスケール ベクタをこの Matrix オブジェクトに適用します。
[Visual Basic] Overloads Public Sub Scale(Single, Single)
[JScript] public function Scale(float, float);
指定した順序を使用して、指定したスケール ベクタ (scaleX と scaleY) をこの Matrix オブジェクトに適用します。
[Visual Basic] Overloads Public Sub Scale(Single, Single, MatrixOrder)
使用例
[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 OnPaint イベントのオブジェクトである PaintEventArgs e が必要です。このコードは次のアクションを実行します。
- スケーリングの変換を適用する前に、画面に四角形を描画します (青い四角形)。
- 行列を作成し、それを x 軸方向に 3 倍、y 軸方向に 2 倍だけスケールします。
- この行列変換を四角形に適用します。
- 変形した四角形を画面に描画します (赤い四角形)。
[Visual Basic, C#] 赤い四角形は、四角形の左上隅 (四角形の開始点) を含めて x 軸方向に 3 倍、y 軸方向に 2 倍スケールされます。
[Visual Basic, C#] メモ ここでは、Scale のオーバーロード形式のうちの 1 つだけについて、使用例を示します。その他の例については、各オーバーロード形式のトピックを参照してください。
Public Sub ScaleExample(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
[C#]
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);
}
[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。