Brushes Class
Assembly: System.Drawing (in system.drawing.dll)
The Brushes class contains static read-only properties that return a Brush object of the color indicated by the property name. You typically do not have to explicitly dispose of the brush returned by a property in this class, unless it is used to construct a new brush.
The following code example demonstrates the how to use a member of the Brushes class to fill a Rectangle. This example should be used with a Windows Form. Paste this code into a form and call this method when handling the form's Paint event, passing e as PaintEventArgs.
Private Sub InstanceRectangleIntersection( _ ByVal e As PaintEventArgs) Dim rectangle1 As New Rectangle(50, 50, 200, 100) Dim rectangle2 As New Rectangle(70, 20, 100, 200) e.Graphics.DrawRectangle(Pens.Black, rectangle1) e.Graphics.DrawRectangle(Pens.Red, rectangle2) If (rectangle1.IntersectsWith(rectangle2)) Then rectangle1.Intersect(rectangle2) If Not (rectangle1.IsEmpty) Then e.Graphics.FillRectangle(Brushes.Green, rectangle1) End If End If End Sub
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.