Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
Brush is an abstract base class used in C# programming language to define objects for filling the interiors of graphical shapes with a solid color, gradient pattern, image or drawing.
Brush class cannot be instantiated itself but forms the base for all its derived classes, which describe how the graphical area is painted. The graphical shapes that can be filled using brushes include rectangles, ellipses, pies, polygons and paths. Brush objects can be used with graphical objects to create solid shapes and to render text.
In .NET framework 4.0, brush class is implemented in two forms: the brush used in the Graphics Device Interface+ (GDI+) and the Windows Presentation Framework (WPF) brush. In the former case, brush class inherits from System.Drawing and uses the concept of current brush; the latter inherits from System.Windows.Media and the brush object must be passed for each drawing call. The WPF brush has advanced features that enable users to paint user interface objects with anything from simple solid colors to complex sets of patterns and images.
Brush class has the following features:
Brush class is one of the drawing resource classes used to provide different filling pattern for an enclosed surface. It forms a managed wrapper to the underlying unmanaged native Win32 GDI resource, HBRUSH. As one of the fundamental components of GDI+, which is designed for performance and ease of use, it is used in combination with other GDI+ objects, such as pens and colors, to render graphical images on Windows forms and controls.
The different types of brushes used in GDI+ are implemented in the following classes: