Brushes Class
Brushes for all the standard colors. This class cannot be inherited.
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 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.