次の方法で共有


LinearGradientBrush.MultiplyTransform メソッド

指定された Matrix を先に適用するように指定して、 LinearGradientBrush のローカル ジオメトリック変換を表す Matrix オブジェクトに、この指定された Matrix を掛け合わせます。

オーバーロードの一覧

指定された Matrix を付加することで、この LinearGradientBrush オブジェクトのローカル ジオメトリック変換を表す Matrix オブジェクトに、指定された Matrix を乗算します。

[Visual Basic] Overloads Public Sub MultiplyTransform(Matrix)

[C#] public void MultiplyTransform(Matrix);

[C++] public: void MultiplyTransform(Matrix*);

[JScript] public function MultiplyTransform(Matrix);

LinearGradientBrush オブジェクトのローカル ジオメトリック変換を表す Matrix オブジェクトに、指定された Matrix を指定された順序で乗算します。

[Visual Basic] Overloads Public Sub MultiplyTransform(Matrix, MatrixOrder)

[C#] public void MultiplyTransform(Matrix, MatrixOrder);

[C++] public: void MultiplyTransform(Matrix*, MatrixOrder);

[JScript] public function MultiplyTransform(Matrix, MatrixOrder);

使用例

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

  • 新しい LinearGradientBrush オブジェクトを作成します。
  • ブラシを使用して画面に楕円を描画します。
  • MultiplyTransform メソッドを呼び出して、 LinearGradientBrush オブジェクトを変換します。
  • 変換されたブラシを使用して、最初の楕円のすぐ下にもう 1 つ楕円を画面に描画します。

[Visual Basic, C#] 下の楕円は水平方向に拡大され、新しい形状に合わせてグラデーションも拡大されます。

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

 
Public Sub MultiplyTransformExample(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)
' Transform the LinearGradientBrush.
Dim transformArray As Point() =  {New Point(20, 150), _
New Point(400, 150), New Point(20, 200)}
Dim myMatrix As New Matrix(myRect, transformArray)
myLGBrush.MultiplyTransform(myMatrix, MatrixOrder.Prepend)
' Draw a second ellipse to the screen using the transformed brush.
e.Graphics.FillEllipse(myLGBrush, 20, 150, 380, 50)
End Sub
        
[C#] 
private void MultiplyTransformExample(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);
// Transform the LinearGradientBrush.
Point[] transformArray =
{
new Point(20, 150),
new Point(400,150),
new Point(20, 200)
};
Matrix myMatrix = new Matrix(myRect, transformArray);
myLGBrush.MultiplyTransform(
myMatrix,
MatrixOrder.Prepend);
// Draw a second ellipse to the screen using
// the transformed brush.
e.Graphics.FillEllipse(myLGBrush, 20, 150, 380, 50);
}
        

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

参照

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