Region 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化新的 Region。
重载
| 名称 | 说明 |
|---|---|
| Region() |
初始化新的 Region。 |
| Region(GraphicsPath) |
用指定的Region值初始化新GraphicsPath项。 |
| Region(RegionData) |
初始化指定数据中的新 Region 数据。 |
| Region(Rectangle) | |
| Region(RectangleF) |
初始化指定Region结构中的新RectangleF内容。 |
Region(GraphicsPath)
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
用指定的Region值初始化新GraphicsPath项。
public:
Region(System::Drawing::Drawing2D::GraphicsPath ^ path);
public Region(System.Drawing.Drawing2D.GraphicsPath path);
new System.Drawing.Region : System.Drawing.Drawing2D.GraphicsPath -> System.Drawing.Region
Public Sub New (path As GraphicsPath)
参数
- path
- GraphicsPath
GraphicsPath一个定义新的 Region。
例外
path 是 null。
注解
此方法使用 RegionGraphicsPath.. 新区域定义为参数指定的GraphicsPath内部path区域。
适用于
Region(RegionData)
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
初始化指定数据中的新 Region 数据。
public:
Region(System::Drawing::Drawing2D::RegionData ^ rgnData);
public Region(System.Drawing.Drawing2D.RegionData rgnData);
new System.Drawing.Region : System.Drawing.Drawing2D.RegionData -> System.Drawing.Region
Public Sub New (rgnData As RegionData)
参数
- rgnData
- RegionData
定义新RegionData内部的 ARegion。
例外
rgnData 是 null。
注解
此方法使用现有Region内部定义的内部创建一个新Region方法。 参数 rgnData 是包含现有 Region定义的数组。
适用于
Region(Rectangle)
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
public:
Region(System::Drawing::Rectangle rect);
public Region(System.Drawing.Rectangle rect);
new System.Drawing.Region : System.Drawing.Rectangle -> System.Drawing.Region
Public Sub New (rect As Rectangle)
参数
示例
下面的代码示例演示如何使用 Region 构造函数和 MakeEmpty 方法。 此示例旨在与 Windows 窗体一起使用。 创建窗体并将以下代码粘贴到其中。
FillEmptyRegion在窗体Paint的事件处理方法中调用该方法,并e传递为 PaintEventArgs。
private:
void FillEmptyRegion( PaintEventArgs^ e )
{
// Create a region from a rectangle.
Rectangle originalRectangle = Rectangle(40,40,40,50);
System::Drawing::Region^ smallRegion = gcnew System::Drawing::Region( originalRectangle );
// Call MakeEmpty.
smallRegion->MakeEmpty();
// Fill the region in red and draw the original rectangle
// in black. Note there is nothing filled in.
e->Graphics->FillRegion( Brushes::Red, smallRegion );
e->Graphics->DrawRectangle( Pens::Black, originalRectangle );
}
private void FillEmptyRegion(PaintEventArgs e)
{
// Create a region from a rectangle.
Rectangle originalRectangle = new Rectangle(40, 40, 40, 50);
Region smallRegion = new Region(originalRectangle);
// Call MakeEmpty.
smallRegion.MakeEmpty();
// Fill the region in red and draw the original rectangle
// in black. Note there is nothing filled in.
e.Graphics.FillRegion(Brushes.Red, smallRegion);
e.Graphics.DrawRectangle(Pens.Black, originalRectangle);
}
Private Sub FillEmptyRegion(ByVal e As PaintEventArgs)
' Create a region from a rectangle.
Dim originalRectangle As New Rectangle(40, 40, 40, 50)
Dim smallRegion As New Region(originalRectangle)
' Call MakeEmpty.
smallRegion.MakeEmpty()
' Fill the region in red and draw the original rectangle
' in black. Note there is nothing filled in.
e.Graphics.FillRegion(Brushes.Red, smallRegion)
e.Graphics.DrawRectangle(Pens.Black, originalRectangle)
End Sub
注解
此方法使用矩形内部创建一个新 Region 方法。 内部由 rect 参数定义。
适用于
Region(RectangleF)
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
初始化指定Region结构中的新RectangleF内容。
public:
Region(System::Drawing::RectangleF rect);
public Region(System.Drawing.RectangleF rect);
new System.Drawing.Region : System.Drawing.RectangleF -> System.Drawing.Region
Public Sub New (rect As RectangleF)
参数
- rect
- RectangleF
定义 RectangleF 新 Region内部的结构。
注解
此方法使用矩形内部创建一个新 Region 方法。 内部由 rect 参数定义。