Graphics.ExcludeClip 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
ExcludeClip(Region) | |
ExcludeClip(Rectangle) |
ExcludeClip(Region)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- 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 像素的 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 );
}
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 属性。
适用于
ExcludeClip(Rectangle)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- 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 像素的 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 );
}
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 属性。