Rectangle コンストラクタ (Int32, Int32, Int32, Int32)
アセンブリ: System.Drawing (system.drawing.dll 内)

Dim x As Integer Dim y As Integer Dim width As Integer Dim height As Integer Dim instance As New Rectangle(x, y, width, height)

Rectangle、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 ); } } }

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Rectangle コンストラクタ (Point, Size)
アセンブリ: System.Drawing (system.drawing.dll 内)


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Rectangle コンストラクタ
- Rectangle コンストラクタのページへのリンク