Graphics.DrawRectangle メソッド (Pen, Rectangle)
アセンブリ: System.Drawing (system.drawing.dll 内)



次の例は、Windows フォームでの使用を意図してデザインされており、Paint イベント ハンドラのパラメータである PaintEventArgse が必要です。このコードは次のアクションを実行します。
Public Sub DrawRectangleRectangle(ByVal e As PaintEventArgs) ' Create pen. Dim blackPen As New Pen(Color.Black, 3) ' Create rectangle. Dim rect As New Rectangle(0, 0, 200, 200) ' Draw rectangle to screen. e.Graphics.DrawRectangle(blackPen, rect) End Sub
public void DrawRectangleRectangle(PaintEventArgs e) { // Create pen. Pen blackPen = new Pen(Color.Black, 3); // Create rectangle. Rectangle rect = new Rectangle(0, 0, 200, 200); // Draw rectangle to screen. e.Graphics.DrawRectangle(blackPen, rect); }

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


Graphics.DrawRectangle メソッド

名前 | 説明 |
---|---|
Graphics.DrawRectangle (Pen, Rectangle) | Rectangle 構造体で指定された四角形を描画します。 .NET Compact Framework によってサポートされています。 |
Graphics.DrawRectangle (Pen, Int32, Int32, Int32, Int32) | 座標ペア、幅、および高さで指定された四角形を描画します。 .NET Compact Framework によってサポートされています。 |
Graphics.DrawRectangle (Pen, Single, Single, Single, Single) | 座標ペア、幅、および高さで指定された四角形を描画します。 |

Graphics.DrawRectangle メソッド (Pen, Single, Single, Single, Single)
アセンブリ: System.Drawing (system.drawing.dll 内)

Public Sub DrawRectangle ( _ pen As Pen, _ x As Single, _ y As Single, _ width As Single, _ height As Single _ )
Dim instance As Graphics Dim pen As Pen Dim x As Single Dim y As Single Dim width As Single Dim height As Single instance.DrawRectangle(pen, x, y, width, height)


次の例は、Windows フォームでの使用を意図してデザインされており、Paint イベント ハンドラのパラメータである PaintEventArgse が必要です。このコードは次のアクションを実行します。
Public Sub DrawRectangleFloat(ByVal e As PaintEventArgs) ' Create pen. Dim blackPen As New Pen(Color.Black, 3) ' Create location and size of rectangle. Dim x As Single = 0.0F Dim y As Single = 0.0F Dim width As Single = 200.0F Dim height As Single = 200.0F ' Draw rectangle to screen. e.Graphics.DrawRectangle(blackPen, x, y, width, height) End Sub
public void DrawRectangleFloat(PaintEventArgs e) { // Create pen. Pen blackPen = new Pen(Color.Black, 3); // Create location and size of rectangle. float x = 0.0F; float y = 0.0F; float width = 200.0F; float height = 200.0F; // Draw rectangle to screen. e.Graphics.DrawRectangle(blackPen, x, y, width, height); }
public: void DrawRectangleFloat( PaintEventArgs^ e ) { // Create pen. Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); // Create location and size of rectangle. float x = 0.0F; float y = 0.0F; float width = 200.0F; float height = 200.0F; // Draw rectangle to screen. e->Graphics->DrawRectangle( blackPen, x, y, width, height ); }
public void DrawRectangleFloat(PaintEventArgs e) { // Create pen. Pen blackPen = new Pen(Color.get_Black(), 3); // Create location and size of rectangle. float x = 0; float y = 0; float width = 200; float height = 200; // Draw rectangle to screen. e.get_Graphics().DrawRectangle(blackPen, x, y, width, height); } //DrawRectangleFloat

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


Graphics.DrawRectangle メソッド (Pen, Int32, Int32, Int32, Int32)
アセンブリ: System.Drawing (system.drawing.dll 内)

Public Sub DrawRectangle ( _ pen As Pen, _ x As Integer, _ y As Integer, _ width As Integer, _ height As Integer _ )
Dim instance As Graphics Dim pen As Pen Dim x As Integer Dim y As Integer Dim width As Integer Dim height As Integer instance.DrawRectangle(pen, x, y, width, height)


次の例は、Windows フォームでの使用を意図してデザインされており、Paint イベント ハンドラのパラメータである PaintEventArgse が必要です。このコードは次のアクションを実行します。
Public Sub DrawRectangleInt(ByVal e As PaintEventArgs) ' Create pen. Dim blackPen As New Pen(Color.Black, 3) ' Create location and size of rectangle. Dim x As Integer = 0 Dim y As Integer = 0 Dim width As Integer = 200 Dim height As Integer = 200 ' Draw rectangle to screen. e.Graphics.DrawRectangle(blackPen, x, y, width, height) End Sub
public void DrawRectangleInt(PaintEventArgs e) { // Create pen. Pen blackPen = new Pen(Color.Black, 3); // Create location and size of rectangle. int x = 0; int y = 0; int width = 200; int height = 200; // Draw rectangle to screen. e.Graphics.DrawRectangle(blackPen, x, y, width, height); }
public: void DrawRectangleInt( PaintEventArgs^ e ) { // Create pen. Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); // Create location and size of rectangle. int x = 0; int y = 0; int width = 200; int height = 200; // Draw rectangle to screen. e->Graphics->DrawRectangle( blackPen, x, y, width, height ); }
public void DrawRectangleInt(PaintEventArgs e) { // Create pen. Pen blackPen = new Pen(Color.get_Black(), 3); // Create location and size of rectangle. int x = 0; int y = 0; int width = 200; int height = 200; // Draw rectangle to screen. e.get_Graphics().DrawRectangle(blackPen, x, y, width, height); } //DrawRectangleInt

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


- Graphics.DrawRectangleのページへのリンク