Graphics.ExcludeClip 方法
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
public:
void ExcludeClip(System::Drawing::Region ^ region);
C#
public void ExcludeClip(System.Drawing.Region region);
member this.ExcludeClip : System.Drawing.Region -> unit
Public Sub ExcludeClip (region As Region)
参数
示例
下面的代码示例设计用于 Windows 窗体,它需要 PaintEventArgse
,这是 Paint 事件处理程序的参数。 该代码执行以下操作:
创建一个 100 像素的 100 像素矩形,其左上角位于坐标处(100,100)。
设置剪辑区域以排除矩形。
用纯蓝色画笔填充一个 300 像素的 300 像素矩形,其左上角位于坐标(0,0)。
结果是一个蓝色矩形,其右下角缺少正方形区域。
public:
void ExcludeClipRegion( PaintEventArgs^ e )
{
// Create rectangle for region.
Rectangle excludeRect = Rectangle(100,100,200,200);
// Create region for exclusion.
System::Drawing::Region^ excludeRegion = gcnew System::Drawing::Region( excludeRect );
// Set clipping region to exclude region.
e->Graphics->ExcludeClip( excludeRegion );
// Fill large rectangle to show clipping region.
e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 300, 300 );
}
C#
public void ExcludeClipRegion(PaintEventArgs e)
{
// Create rectangle for region.
Rectangle excludeRect = new Rectangle(100, 100, 200, 200);
// Create region for exclusion.
Region excludeRegion = new Region(excludeRect);
// Set clipping region to exclude region.
e.Graphics.ExcludeClip(excludeRegion);
// Fill large rectangle to show clipping region.
e.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 300, 300);
}
Public Sub ExcludeClipRegion(ByVal e As PaintEventArgs)
' Create rectangle for region.
Dim excludeRect As New Rectangle(100, 100, 200, 200)
' Create region for exclusion.
Dim excludeRegion As New [Region](excludeRect)
' Set clipping region to exclude region.
e.Graphics.ExcludeClip(excludeRegion)
' Fill large rectangle to show clipping region.
e.Graphics.FillRectangle(New SolidBrush(Color.Blue), 0, 0, _
300, 300)
End Sub
注解
此方法从当前剪辑区域排除由 region
参数指定的区域,并将生成的区域分配给此 Graphics的 Clip 属性。
适用于
.NET 10 (package-provided) 和其他版本
产品 | 版本 |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided) |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
public:
void ExcludeClip(System::Drawing::Rectangle rect);
C#
public void ExcludeClip(System.Drawing.Rectangle rect);
member this.ExcludeClip : System.Drawing.Rectangle -> unit
Public Sub ExcludeClip (rect As Rectangle)
参数
示例
下面的代码示例设计用于 Windows 窗体,它需要 PaintEventArgse
,这是 Paint 事件处理程序的参数。 该代码执行以下操作:
创建一个 100 像素的 100 像素矩形,其左上角位于坐标处(100,100)。
创建由矩形定义的区域。
设置剪辑区域以排除矩形区域。
用纯蓝色画笔填充一个 300 像素的 300 像素矩形,其左上角位于坐标(0,0)。
结果是一个蓝色矩形,其右下角缺少一个正方形区域。
public:
void ExcludeClipRectangle( PaintEventArgs^ e )
{
// Create rectangle for exclusion.
Rectangle excludeRect = Rectangle(100,100,200,200);
// Set clipping region to exclude rectangle.
e->Graphics->ExcludeClip( excludeRect );
// Fill large rectangle to show clipping region.
e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 300, 300 );
}
C#
public void ExcludeClipRectangle(PaintEventArgs e)
{
// Create rectangle for exclusion.
Rectangle excludeRect = new Rectangle(100, 100, 200, 200);
// Set clipping region to exclude rectangle.
e.Graphics.ExcludeClip(excludeRect);
// Fill large rectangle to show clipping region.
e.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 300, 300);
}
Public Sub ExcludeClipRectangle(ByVal e As PaintEventArgs)
' Create rectangle for exclusion.
Dim excludeRect As New Rectangle(100, 100, 200, 200)
' Set clipping region to exclude rectangle.
e.Graphics.ExcludeClip(excludeRect)
' Fill large rectangle to show clipping region.
e.Graphics.FillRectangle(New SolidBrush(Color.Blue), 0, 0, _
300, 300)
End Sub
注解
此方法从当前剪辑区域排除由 rect
参数指定的区域,并将生成的区域分配给此 Graphics的 Clip 属性。
适用于
.NET 10 (package-provided) 和其他版本
产品 | 版本 |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided) |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |