Graphics.ExcludeClip 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
ExcludeClip(Region) | |
ExcludeClip(Rectangle) |
ExcludeClip(Region)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
public:
void ExcludeClip(System::Drawing::Region ^ region);
public void ExcludeClip (System.Drawing.Region region);
member this.ExcludeClip : System.Drawing.Region -> unit
Public Sub ExcludeClip (region As Region)
参数
示例
下面的代码示例旨在与 Windows 窗体 一起使用,它需要 PaintEventArgse
,它是 事件处理程序的Paint一个参数。 此代码执行以下操作:
创建一个 100 像素 x 100 像素矩形,其左上角位于坐标 (100,100) 。
设置剪裁区域以排除矩形。
使用纯蓝色画笔填充 300 像素 x 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 );
}
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
区域,并将生成的区域 Clip 分配给此 Graphics的 属性。
适用于
ExcludeClip(Rectangle)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
public:
void ExcludeClip(System::Drawing::Rectangle rect);
public void ExcludeClip (System.Drawing.Rectangle rect);
member this.ExcludeClip : System.Drawing.Rectangle -> unit
Public Sub ExcludeClip (rect As Rectangle)
参数
示例
下面的代码示例旨在与 Windows 窗体 一起使用,它需要 PaintEventArgse
,它是 事件处理程序的Paint一个参数。 此代码执行以下操作:
创建一个 100 像素 x 100 像素矩形,其左上角位于坐标 (100,100) 。
创建由矩形定义的区域。
设置剪裁区域以排除矩形区域。
使用纯蓝色画笔填充 300 像素 x 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 );
}
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
区域,并将生成的区域 Clip 分配给此 Graphics的 属性。
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈