GraphicsPath.AddRectangle Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds a rectangle to this path.
Overloads
AddRectangle(RectangleF) |
Adds a rectangle to this path. |
AddRectangle(Rectangle) |
Adds a rectangle to this path. |
AddRectangle(RectangleF)
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
Adds a rectangle to this path.
public:
void AddRectangle(System::Drawing::RectangleF rect);
public void AddRectangle (System.Drawing.RectangleF rect);
member this.AddRectangle : System.Drawing.RectangleF -> unit
Public Sub AddRectangle (rect As RectangleF)
Parameters
- rect
- RectangleF
A RectangleF that represents the rectangle to add.
Examples
For an example, see AddRectangle(Rectangle).
Applies to
AddRectangle(Rectangle)
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
Adds a rectangle to this path.
public:
void AddRectangle(System::Drawing::Rectangle rect);
public void AddRectangle (System.Drawing.Rectangle rect);
member this.AddRectangle : System.Drawing.Rectangle -> unit
Public Sub AddRectangle (rect As Rectangle)
Parameters
Examples
The following code example is designed for use with Windows Forms, and it requires PaintEventArgs e
, an OnPaint event object. The code performs the following actions:
Creates a path.
Creates a rectangle and adds the rectangle to the path.
Draws the path to the screen.
private:
void AddRectangleExample( PaintEventArgs^ e )
{
// Create a GraphicsPath object and add a rectangle to it.
GraphicsPath^ myPath = gcnew GraphicsPath;
Rectangle pathRect = Rectangle(20,20,100,200);
myPath->AddRectangle( pathRect );
// Draw the path to the screen.
Pen^ myPen = gcnew Pen( Color::Black,2.0f );
e->Graphics->DrawPath( myPen, myPath );
}
private void AddRectangleExample(PaintEventArgs e)
{
// Create a GraphicsPath object and add a rectangle to it.
GraphicsPath myPath = new GraphicsPath();
Rectangle pathRect = new Rectangle(20, 20, 100, 200);
myPath.AddRectangle(pathRect);
// Draw the path to the screen.
Pen myPen = new Pen(Color.Black, 2);
e.Graphics.DrawPath(myPen, myPath);
}
Public Sub AddRectangleExample(ByVal e As PaintEventArgs)
' Create a GraphicsPath object and add a rectangle to it.
Dim myPath As New GraphicsPath
Dim pathRect As New Rectangle(20, 20, 100, 200)
myPath.AddRectangle(pathRect)
' Draw the path to the screen.
Dim myPen As New Pen(Color.Black, 2)
e.Graphics.DrawPath(myPen, myPath)
End Sub
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기