次の方法で共有


LinearGradientBrush.ScaleTransform メソッド

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

オーバーロードの一覧

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

[Visual Basic] Overloads Public Sub ScaleTransform(Single, Single)

[C#] public void ScaleTransform(float, float);

[C++] public: void ScaleTransform(float, float);

[JScript] public function ScaleTransform(float, float);

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

[Visual Basic] Overloads Public Sub ScaleTransform(Single, Single, MatrixOrder)

[C#] public void ScaleTransform(float, float, MatrixOrder);

[C++] public: void ScaleTransform(float, float, MatrixOrder);

[JScript] public function ScaleTransform(float, float, MatrixOrder);

使用例

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

  • 新しい LinearGradientBrush オブジェクトを作成します。
  • ブラシを使用して画面に楕円を描画します。
  • LinearGradientBrush オブジェクトを x 軸方向に 2 倍スケールします。
  • スケールされたブラシを使用して、最初の楕円のすぐ下にもう 1 つ楕円を画面に描画します。

[Visual Basic, C#] 下の楕円のグラデーションは、2 倍に拡大されます。また、 TranslateTransform メソッドを呼び出すことで、グラデーションの塗りつぶしの左端が、楕円の左端と揃えられます。

[Visual Basic, C#] メモ   ここでは、ScaleTransform のオーバーロード形式のうちの 1 つだけについて、使用例を示します。その他の例については、各オーバーロード形式のトピックを参照してください。

 
Public Sub ScaleTransformExample(e As PaintEventArgs)
' Create a LinearGradientBrush.
Dim myRect As New Rectangle(20, 20, 200, 100)
Dim myLGBrush As New LinearGradientBrush(myRect, Color.Blue, _
Color.Red, 0F, True)
' Draw an ellipse to the screen using the LinearGradientBrush.
e.Graphics.FillEllipse(myLGBrush, myRect)
' Scale the LinearGradientBrush.
myLGBrush.ScaleTransform(2F, 1F, MatrixOrder.Prepend)
' Rejustify the brush to start at the left edge of the ellipse.
myLGBrush.TranslateTransform(- 20F, 0F)
' Draw a second ellipse to the screen using the transformed brush.
e.Graphics.FillEllipse(myLGBrush, 20, 150, 200, 100)
End Sub
        
[C#] 
private void ScaleTransformExample(PaintEventArgs e)
{
// Create a LinearGradientBrush.
Rectangle myRect = new Rectangle(20, 20, 200, 100);
LinearGradientBrush myLGBrush = new LinearGradientBrush(
myRect,
Color.Blue,
Color.Red,
0.0f,
true);
// Draw an ellipse to the screen using the LinearGradientBrush.
e.Graphics.FillEllipse(myLGBrush, myRect);
// Scale the LinearGradientBrush.
myLGBrush.ScaleTransform(
2.0f,
1.0f,
MatrixOrder.Prepend);
// Rejustify the brush to start at the left edge of the ellipse.
myLGBrush.TranslateTransform(-20.0f, 0.0f);
// Draw a second ellipse to the screen using
// the transformed brush.
e.Graphics.FillEllipse(myLGBrush, 20, 150, 200, 100);
}
        

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

参照

LinearGradientBrush クラス | LinearGradientBrush メンバ | System.Drawing.Drawing2D 名前空間