Rectangle.IsEmpty プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Rectangle.IsEmpty プロパティの意味・解説 

Rectangle.IsEmpty プロパティ

この Rectangle のすべての数値プロパティに値ゼロがあるかどうかをテストします。

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

使用例使用例

Intersect) メンバ、IsEmpty メンバ、および IntersectsWith メンバのコード例を次に示します。この例は、Windows フォームで使用する必要があります。このコードをフォームに貼り付け、フォームの Paint イベントを処理するときに PaintEventArgs の e を渡してこのメソッドを呼び出します。

Private Sub InstanceRectangleIntersection(
 _
    ByVal e As PaintEventArgs)

    Dim rectangle1 As New
 Rectangle(50, 50, 200, 100)
    Dim rectangle2 As New
 Rectangle(70, 20, 100, 200)
  
    e.Graphics.DrawRectangle(Pens.Black, rectangle1)
    e.Graphics.DrawRectangle(Pens.Red, rectangle2)

    If (rectangle1.IntersectsWith(rectangle2)) Then
        rectangle1.Intersect(rectangle2)
        If Not (rectangle1.IsEmpty) Then
            e.Graphics.FillRectangle(Brushes.Green, rectangle1)
        End If
    End If
End Sub
private void InstanceRectangleIntersection(PaintEventArgs
 e)
{

    Rectangle rectangle1 = new Rectangle(50, 50, 200, 100);
    Rectangle rectangle2 = new Rectangle(70, 20, 100, 200);

    e.Graphics.DrawRectangle(Pens.Black, rectangle1);
    e.Graphics.DrawRectangle(Pens.Red, rectangle2);

    if (rectangle1.IntersectsWith(rectangle2))
    {
        rectangle1.Intersect(rectangle2);
        if (!rectangle1.IsEmpty)
        {
            e.Graphics.FillRectangle(Brushes.Green, rectangle1);
        }
    }
}
private:
   void InstanceRectangleIntersection( PaintEventArgs^ e )
   {
      Rectangle rectangle1 = Rectangle(50,50,200,100);
      Rectangle rectangle2 = Rectangle(70,20,100,200);
      e->Graphics->DrawRectangle( Pens::Black, rectangle1 );
      e->Graphics->DrawRectangle( Pens::Red, rectangle2 );
      if ( rectangle1.IntersectsWith( rectangle2 ) )
      {
         rectangle1.Intersect( rectangle2 );
         if (  !rectangle1.IsEmpty )
         {
            e->Graphics->FillRectangle( Brushes::Green, rectangle1 );
         }
      }
   }
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

Rectangle.IsEmpty プロパティのお隣キーワード

   

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



Rectangle.IsEmpty プロパティのページの著作権

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

©2026 GRAS Group, Inc.RSS