Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

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

Region.GetBounds メソッド

Graphics オブジェクト描画サーフェイスのこの Region外接する四角形を表す RectangleF 構造体取得します

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

Public Function GetBounds ( _
    g As Graphics _
) As RectangleF
Dim instance As Region
Dim g As Graphics
Dim returnValue As RectangleF

returnValue = instance.GetBounds(g)
public RectangleF GetBounds (
    Graphics g
)
public:
RectangleF GetBounds (
    Graphics^ g
)
public RectangleF GetBounds (
    Graphics g
)
public function GetBounds (
    g : Graphics
) : RectangleF

パラメータ

g

この Region描画される Graphics

戻り値
指定描画サーフェイスのこの Region外接する四角形を表す RectangleF 構造体

例外例外
例外種類条件

ArgumentNullException

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

解説解説
使用例使用例

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

Public Sub GetBoundsExample(ByVal
 e As PaintEventArgs)

    ' Create a GraphicsPath and add an ellipse to it.
    Dim myPath As New GraphicsPath
    Dim ellipseRect As New
 Rectangle(20, 20, 100, 100)
    myPath.AddEllipse(ellipseRect)

    ' Fill the path with blue and draw it to the screen.
    Dim myBrush As New SolidBrush(Color.Blue)
    e.Graphics.FillPath(myBrush, myPath)

    ' Create a region using the GraphicsPath.
    Dim myRegion As New
 [Region](myPath)

    ' Get the bounding rectangle for myRegion and draw it to the
    ' screen in Red.
    Dim boundsRect As RectangleF = myRegion.GetBounds(e.Graphics)
    e.Graphics.DrawRectangle(Pens.Red, Rectangle.Round(boundsRect))
End Sub
public void GetBoundsExample(PaintEventArgs
 e)
{
             
    // Create a GraphicsPath and add an ellipse to it.
    GraphicsPath myPath = new GraphicsPath();
    Rectangle ellipseRect = new Rectangle(20, 20, 100, 100);
    myPath.AddEllipse(ellipseRect);
             
    // Fill the path with blue and draw it to the screen.
    SolidBrush myBrush = new SolidBrush(Color.Blue);
    e.Graphics.FillPath(myBrush, myPath);
             
    // Create a region using the GraphicsPath.
    Region myRegion = new Region(myPath);
             
    // Get the bounding rectangle for myRegion and draw it to the
             
    // screen in Red.
    RectangleF boundsRect = myRegion.GetBounds(e.Graphics);
    e.Graphics.DrawRectangle(Pens.Red, Rectangle.Round(boundsRect));
}
public:
   void GetBoundsExample( PaintEventArgs^ e )
   {
      // Create a GraphicsPath and add an ellipse to it.
      GraphicsPath^ myPath = gcnew GraphicsPath;
      Rectangle ellipseRect = Rectangle(20,20,100,100);
      myPath->AddEllipse( ellipseRect );

      // Fill the path with blue and draw it to the screen.
      SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue );
      e->Graphics->FillPath( myBrush, myPath );

      // Create a region using the GraphicsPath.
      System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( myPath );

      // Get the bounding rectangle for myRegion and draw it to the
      // screen in Red.
      RectangleF boundsRect = myRegion->GetBounds( e->Graphics );
      e->Graphics->DrawRectangle( Pens::Red, Rectangle::Round( boundsRect )
 );
   }
public void GetBoundsExample(PaintEventArgs
 e)
{
    // Create a GraphicsPath and add an ellipse to it.
    GraphicsPath myPath = new GraphicsPath();
    Rectangle ellipseRect = new Rectangle(20, 20, 100, 100);

    myPath.AddEllipse(ellipseRect);

    // Fill the path with blue and draw it to the screen.
    SolidBrush myBrush = new SolidBrush(Color.get_Blue());

    e.get_Graphics().FillPath(myBrush, myPath);

    // Create a region using the GraphicsPath.
    Region myRegion = new Region(myPath);

    // Get the bounding rectangle for myRegion and draw it to the
    // screen in Red.
    RectangleF boundsRect = myRegion.GetBounds(e.get_Graphics());

    e.get_Graphics().DrawRectangle(Pens.get_Red(), 
        Rectangle.Round(boundsRect));
} //GetBoundsExample
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS