LinearGradientBrush.ResetTransform メソッド
アセンブリ: System.Drawing (system.drawing.dll 内)


次のコード例は、Windows フォームでの使用を意図してデザインされており、OnPaint イベント オブジェクトである PaintEventArgse が必要です。このコードは次のアクションを実行します。
1 番下の楕円は最初の楕円と同じサイズで描画されるため、ResetTransform メソッドを呼び出すことで、それに合わせてグラデーションが縮小されます。
Public Sub ResetTransformExample(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) ' 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) ' Reset the brush transform. myLGBrush.ResetTransform() ' Draw a third ellipse to the screen using the reset brush. e.Graphics.FillEllipse(myLGBrush, 20, 250, 200, 100) End Sub
private void ResetTransformExample(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); // Reset the brush transform. myLGBrush.ResetTransform(); // Draw a third ellipse to the screen using the reset brush. e.Graphics.FillEllipse(myLGBrush, 20, 250, 200, 100); }
private: void ResetTransformExample( 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 ); // Transform the LinearGradientBrush. array<Point>^ transformArray = {Point(20,150),Point(400,150),Point(20 ,200)}; Matrix^ myMatrix = gcnew 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 ); // Reset the brush transform. myLGBrush->ResetTransform(); // Draw a third ellipse to the screen using the reset brush. e->Graphics->FillEllipse( myLGBrush, 20, 250, 200, 100 ); }
private void ResetTransformExample(PaintEventArgs e) { // Create a LinearGradientBrush. Rectangle myRect = new Rectangle(20, 20, 200, 100); LinearGradientBrush myLGBrush = new LinearGradientBrush(myRect, Color.get_Blue(), Color.get_Red(), 0, true); // Draw an ellipse to the screen using the LinearGradientBrush. e.get_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.get_Graphics().FillEllipse(myLGBrush, 20, 150, 380, 50); // Reset the brush transform. myLGBrush.ResetTransform(); // Draw a third ellipse to the screen using the reset brush. e.get_Graphics().FillEllipse(myLGBrush, 20, 250, 200, 100); } //ResetTransformExample

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からLinearGradientBrush.ResetTransform メソッドを検索する場合は、下記のリンクをクリックしてください。

- LinearGradientBrush.ResetTransform メソッドのページへのリンク