Export (0) Print
Expand All

Region.MakeEmpty Method

Initializes this Region to an empty interior.

Namespace:  System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)

Public Sub MakeEmpty

The following code example demonstrates how to use the Region constructor and MakeEmpty method. This example is designed to be used with Windows Forms. Create a form and paste the following code into it. Call the FillEmptyRegion method in the form's Paint event-handling method, passing e as PaintEventArgs.

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.

    ' 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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
© 2015 Microsoft