次の方法で共有


Graphics.ScaleTransform メソッド (Single, Single, MatrixOrder)

この Graphics オブジェクトの変換行列に、指定したスケーリング操作を指定した順序で適用します。

Overloads Public Sub ScaleTransform( _
   ByVal sx As Single, _   ByVal sy As Single, _   ByVal order As MatrixOrder _)
[C#]
public void ScaleTransform(floatsx,floatsy,MatrixOrderorder);
[C++]
public: void ScaleTransform(floatsx,floatsy,MatrixOrderorder);
[JScript]
public function ScaleTransform(
   sx : float,sy : float,order : MatrixOrder);

パラメータ

  • sx
    x 方向のスケール ファクタ。
  • sy
    y 方向のスケール ファクタ。
  • order
    スケーリング操作が変換行列の前に付加されるか後ろに追加されるかを指定する MatrixOrder 列挙体のメンバ。

戻り値

このメソッドは値を返しません。

解説

スケーリング操作では、変換行列と各要素が (sx, sy, 1) の対角線行列を乗算します。このメソッドは、 order パラメータに従って、 Graphics オブジェクトの変換行列とスケーリング行列を前乗算 (前に付加) または後乗算 (後に追加) します。

使用例

[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 Paint イベント ハンドラのパラメータである PaintEventArgs e が必要です。このコードは次のアクションを実行します。

  • Windows フォームのワールド変換行列を 30 度回転します。
  • MatrixOrder.Append メンバを使用してスケール変換を追加することによって、その行列を x 方向に 3 倍、y 方向に 1 倍拡大します。
  • 回転してスケーリングした四角形を青のペンで描画します。

[Visual Basic, C#] 平行四辺形が生成されます。

 
Public Sub ScaleTransformFloatMatrixOrder(e As PaintEventArgs)
' Set world transform of graphics object to rotate.
e.Graphics.RotateTransform(30F)
' Then to scale, appending to world transform.
e.Graphics.ScaleTransform(3F, 1F, MatrixOrder.Append)
' Draw rotated, scaled rectangle to screen.
e.Graphics.DrawRectangle(New Pen(Color.Blue, 3), 50, 0, 100, 40)
End Sub
        
[C#] 
public void ScaleTransformFloatMatrixOrder(PaintEventArgs e)
{
// Set world transform of graphics object to rotate.
e.Graphics.RotateTransform(30.0F);
// Then to scale, appending to world transform.
e.Graphics.ScaleTransform(3.0F, 1.0F, MatrixOrder.Append);
// Draw rotated, scaled rectangle to screen.
e.Graphics.DrawRectangle(new Pen(Color.Blue, 3), 50, 0, 100, 40);
}
        

[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

Graphics クラス | Graphics メンバ | System.Drawing 名前空間 | Graphics.ScaleTransform オーバーロードの一覧