Graphics.ExcludeClip Method
Updates the clip region of this Graphics object to exclude the area specified by a Rectangle structure.
Overload List
Updates the clip region of this Graphics object to exclude the area specified by a Rectangle structure.
[Visual Basic] Overloads Public Sub ExcludeClip(Rectangle)
[C#] public void ExcludeClip(Rectangle);
[C++] public: void ExcludeClip(Rectangle);
[JScript] public function ExcludeClip(Rectangle);
Updates the clip region of this Graphics object to exclude the area specified by a Region object.
[Visual Basic] Overloads Public Sub ExcludeClip(Region)
[C#] public void ExcludeClip(Region);
[C++] public: void ExcludeClip(Region*);
[JScript] public function ExcludeClip(Region);
Example
[Visual Basic, C#] The following example is designed for use with Windows Forms, and it requires PaintEventArgs e, which is a parameter of the Paint event handler. The code performs the following actions:
- Creates a 100 pixel by 100 pixel rectangle whose upper-left corner is at the coordinate (100, 100).
- Sets the clipping region to exclude the rectangle.
- Fills a 300 pixel by 300 pixel rectangle whose upper-left corner is at the coordinate (0, 0) with a solid blue brush.
[Visual Basic, C#] The result is a blue rectangle with a square area toward its lower-right corner missing.
[Visual Basic, C#] Note This example shows how to use one of the overloaded versions of ExcludeClip. For other examples that might be available, see the individual overload topics.
[Visual Basic] Public Sub ExcludeClipRegion(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 [C#] public void ExcludeClipRegion(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); }
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button
in the upper-left corner of the page.
See Also
Graphics Class | Graphics Members | System.Drawing Namespace