Region.Transform メソッドとは? わかりやすく解説

Region.Transform メソッド

この Region指定Matrix変換します

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

例外例外
例外種類条件

ArgumentNullException

matrixnull 参照 (Visual Basic では Nothing) です。

使用例使用例

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

赤の四角形は元の四角形から 45 度回転し、青で表示されます。

Public Sub TransformExample(ByVal
 e As PaintEventArgs)

    ' Create the first rectangle and draw it to the screen in blue.
    Dim regionRect As New
 Rectangle(100, 50, 100, 100)
    e.Graphics.DrawRectangle(Pens.Blue, regionRect)

    ' Create a region using the first rectangle.
    Dim myRegion As New
 [Region](regionRect)

    ' Create a transform matrix and set it to have a 45 degree
    ' rotation.
    Dim transformMatrix As New
 Matrix
    transformMatrix.RotateAt(45, New PointF(100, 50))

    ' Apply the transform to the region.
    myRegion.Transform(transformMatrix)

    ' Fill the transformed region with red and draw it to the
    ' screen in red.
    Dim myBrush As New SolidBrush(Color.Red)
    e.Graphics.FillRegion(myBrush, myRegion)
End Sub
public void TransformExample(PaintEventArgs
 e)
{
             
    // Create the first rectangle and draw it to the screen in blue.
    Rectangle regionRect = new Rectangle(100, 50, 100, 100);
    e.Graphics.DrawRectangle(Pens.Blue, regionRect);
             
    // Create a region using the first rectangle.
    Region myRegion = new Region(regionRect);
             
    // Create a transform matrix and set it to have a 45 degree
             
    // rotation.
    Matrix transformMatrix = new Matrix();
    transformMatrix.RotateAt(45, new Point(100, 50));
             
    // Apply the transform to the region.
    myRegion.Transform(transformMatrix);
             
    // Fill the transformed region with red and draw it to the screen
             
    // in red.
    SolidBrush myBrush = new SolidBrush(Color.Red);
    e.Graphics.FillRegion(myBrush, myRegion);
}
public:
   void TransformExample( PaintEventArgs^ e )
   {
      
      // Create the first rectangle and draw it to the screen in blue.
      Rectangle regionRect = Rectangle(100,50,100,100);
      e->Graphics->DrawRectangle( Pens::Blue, regionRect );
      
      // Create a region using the first rectangle.
      System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect
 );
      
      // Create a transform matrix and set it to have a 45 degree
      // rotation.
      Matrix^ transformMatrix = gcnew Matrix;
      transformMatrix->RotateAt( 45, Point(100,50) );
      
      // Apply the transform to the region.
      myRegion->Transform(transformMatrix);
      
      // Fill the transformed region with red and draw it to the screen
      // in red.
      SolidBrush^ myBrush = gcnew SolidBrush( Color::Red );
      e->Graphics->FillRegion( myBrush, myRegion );
   }
public void TransformExample(PaintEventArgs
 e)
{
    // Create the first rectangle and draw it to the screen in blue.
    Rectangle regionRect = new Rectangle(100, 50, 100, 100);

    e.get_Graphics().DrawRectangle(Pens.get_Blue(), regionRect);

    // Create a region using the first rectangle.
    Region myRegion = new Region(regionRect);

    // Create a transform matrix and set it to have a 45 degree
    // rotation.
    Matrix transformMatrix = new Matrix();
    
    transformMatrix.RotateAt((float)45, new
 PointF(100, 50));

    // Apply the transform to the region.
    myRegion.Transform(transformMatrix);

    // Fill the transformed region with red and draw it to the screen
    // in red.
    SolidBrush myBrush = new SolidBrush(Color.get_Red());

    e.get_Graphics().FillRegion(myBrush, myRegion);
} //TransformExample
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

Region.Transform メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Region.Transform メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS