GraphicsPath.AddRectangles 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
向此路径添加一系列矩形。
重载
AddRectangles(Rectangle[]) |
向此路径添加一系列矩形。 |
AddRectangles(RectangleF[]) |
向此路径添加一系列矩形。 |
AddRectangles(ReadOnlySpan<Rectangle>) | |
AddRectangles(ReadOnlySpan<RectangleF>) |
AddRectangles(Rectangle[])
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
向此路径添加一系列矩形。
public:
void AddRectangles(cli::array <System::Drawing::Rectangle> ^ rects);
public void AddRectangles (System.Drawing.Rectangle[] rects);
member this.AddRectangles : System.Drawing.Rectangle[] -> unit
Public Sub AddRectangles (rects As Rectangle())
参数
示例
下面的代码示例旨在与 Windows 窗体 一起使用,它需要 PaintEventArgse
事件OnPaint对象。 此代码执行以下操作:
创建路径。
创建矩形数组,并将矩形添加到路径。
绘制屏幕的路径。
private:
void AddRectanglesExample( PaintEventArgs^ e )
{
// Adds a pattern of rectangles to a GraphicsPath object.
GraphicsPath^ myPath = gcnew GraphicsPath;
array<Rectangle>^ pathRects = {Rectangle(20,20,100,200),Rectangle(40,40,120,220),Rectangle(60,60,240,140)};
myPath->AddRectangles( pathRects );
// Draw the path to the screen.
Pen^ myPen = gcnew Pen( Color::Black,2.0f );
e->Graphics->DrawPath( myPen, myPath );
}
private void AddRectanglesExample(PaintEventArgs e)
{
// Adds a pattern of rectangles to a GraphicsPath object.
GraphicsPath myPath = new GraphicsPath();
Rectangle[] pathRects =
{
new Rectangle(20,20,100,200),
new Rectangle(40,40,120,220),
new Rectangle(60,60,240,140)
};
myPath.AddRectangles(pathRects);
// Draw the path to the screen.
Pen myPen = new Pen(Color.Black, 2);
e.Graphics.DrawPath(myPen, myPath);
}
Public Sub AddRectanglesExample(ByVal e As PaintEventArgs)
' Adds a pattern of rectangles to a GraphicsPath object.
Dim myPath As New GraphicsPath
Dim pathRects As Rectangle() = {New Rectangle(20, 20, 100, 200), _
New Rectangle(40, 40, 120, 220), New Rectangle(60, 60, 240, 140)}
myPath.AddRectangles(pathRects)
' Draw the path to the screen.
Dim myPen As New Pen(Color.Black, 2)
e.Graphics.DrawPath(myPen, myPath)
End Sub
适用于
AddRectangles(RectangleF[])
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
向此路径添加一系列矩形。
public:
void AddRectangles(cli::array <System::Drawing::RectangleF> ^ rects);
public:
void AddRectangles(... cli::array <System::Drawing::RectangleF> ^ rects);
public void AddRectangles (System.Drawing.RectangleF[] rects);
public void AddRectangles (params System.Drawing.RectangleF[] rects);
member this.AddRectangles : System.Drawing.RectangleF[] -> unit
Public Sub AddRectangles (rects As RectangleF())
Public Sub AddRectangles (ParamArray rects As RectangleF())
参数
- rects
- RectangleF[]
一个 RectangleF 结构的数组,它表示要添加的矩形。
示例
有关示例,请参见 AddRectangles(Rectangle[])。
适用于
AddRectangles(ReadOnlySpan<Rectangle>)
- Source:
- GraphicsPath.cs
public:
void AddRectangles(ReadOnlySpan<System::Drawing::Rectangle> rects);
public void AddRectangles (ReadOnlySpan<System.Drawing.Rectangle> rects);
member this.AddRectangles : ReadOnlySpan<System.Drawing.Rectangle> -> unit
Public Sub AddRectangles (rects As ReadOnlySpan(Of Rectangle))
参数
- rects
- ReadOnlySpan<Rectangle>
适用于
AddRectangles(ReadOnlySpan<RectangleF>)
- Source:
- GraphicsPath.cs
public:
void AddRectangles(ReadOnlySpan<System::Drawing::RectangleF> rects);
public void AddRectangles (ReadOnlySpan<System.Drawing.RectangleF> rects);
member this.AddRectangles : ReadOnlySpan<System.Drawing.RectangleF> -> unit
Public Sub AddRectangles (rects As ReadOnlySpan(Of RectangleF))
参数
- rects
- ReadOnlySpan<RectangleF>
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈