次の方法で共有


LinearGradientBrush.ScaleTransform メソッド

定義

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

オーバーロード

ScaleTransform(Single, Single)

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

ScaleTransform(Single, Single, MatrixOrder)

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

ScaleTransform(Single, Single)

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

ソース:
LinearGradientBrush.cs
ソース:
LinearGradientBrush.cs
ソース:
LinearGradientBrush.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です。 コードは、次のアクションを実行します。

  • 新しい LinearGradientBrush を作成します。

  • このブラシを使用して、画面に楕円を描画します。

  • x 軸の LinearGradientBrush 2 倍の倍率で をスケーリングします。

  • 拡大縮小されたブラシを使用して、最初の楕円のすぐ下の画面に楕円を描画します。

下の楕円のグラデーションは、2 の係数で引き伸ばされていることに注意してください。 また、 メソッドの TranslateTransform 呼び出しは、グラデーションの塗りつぶしの左端を楕円の左端で揃えるために使用されます。

private:
   void ScaleTransformExample( PaintEventArgs^ e )
   {
      // Create a LinearGradientBrush.
      Rectangle myRect = Rectangle(20,20,200,100);
      LinearGradientBrush^ myLGBrush = gcnew 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 );
   }
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);
}
Public Sub ScaleTransformExample(ByVal 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, 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)
End Sub

適用対象