Brushes Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Brushes for all the standard colors. This class cannot be inherited.
public ref class Brushes abstract sealed
public ref class Brushes sealed
public static class Brushes
public sealed class Brushes
type Brushes = class
Public Class Brushes
Public NotInheritable Class Brushes
- Inheritance
-
Brushes
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:
void InstanceRectangleIntersection( PaintEventArgs^ e )
{
Rectangle rectangle1 = Rectangle(50,50,200,100);
Rectangle rectangle2 = Rectangle(70,20,100,200);
e->Graphics->DrawRectangle( Pens::Black, rectangle1 );
e->Graphics->DrawRectangle( Pens::Red, rectangle2 );
if ( rectangle1.IntersectsWith( rectangle2 ) )
{
rectangle1.Intersect( rectangle2 );
if ( !rectangle1.IsEmpty )
{
e->Graphics->FillRectangle( Brushes::Green, rectangle1 );
}
}
}
private void InstanceRectangleIntersection(PaintEventArgs e)
{
Rectangle rectangle1 = new Rectangle(50, 50, 200, 100);
Rectangle rectangle2 = new Rectangle(70, 20, 100, 200);
e.Graphics.DrawRectangle(Pens.Black, rectangle1);
e.Graphics.DrawRectangle(Pens.Red, rectangle2);
if (rectangle1.IntersectsWith(rectangle2))
{
rectangle1.Intersect(rectangle2);
if (!rectangle1.IsEmpty)
{
e.Graphics.FillRectangle(Brushes.Green, rectangle1);
}
}
}
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
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. For more information about the colors represented by the brushes in this class, see List of colors by name.
Megjegyzés
In .NET 6 and later versions, the System.Drawing.Common package, which includes this type, is only supported on Windows operating systems. Use of this type in cross-platform apps causes compile-time warnings and run-time exceptions. For more information, see System.Drawing.Common only supported on Windows.
Alice |
Gets a system-defined Brush object. |
Antique |
Gets a system-defined Brush object. |
Aqua |
Gets a system-defined Brush object. |
Aquamarine |
Gets a system-defined Brush object. |
Azure |
Gets a system-defined Brush object. |
Beige |
Gets a system-defined Brush object. |
Bisque |
Gets a system-defined Brush object. |
Black |
Gets a system-defined Brush object. |
Blanched |
Gets a system-defined Brush object. |
Blue |
Gets a system-defined Brush object. |
Blue |
Gets a system-defined Brush object. |
Brown |
Gets a system-defined Brush object. |
Burly |
Gets a system-defined Brush object. |
Cadet |
Gets a system-defined Brush object. |
Chartreuse |
Gets a system-defined Brush object. |
Chocolate |
Gets a system-defined Brush object. |
Coral |
Gets a system-defined Brush object. |
Cornflower |
Gets a system-defined Brush object. |
Cornsilk |
Gets a system-defined Brush object. |
Crimson |
Gets a system-defined Brush object. |
Cyan |
Gets a system-defined Brush object. |
Dark |
Gets a system-defined Brush object. |
Dark |
Gets a system-defined Brush object. |
Dark |
Gets a system-defined Brush object. |
Dark |
Gets a system-defined Brush object. |
Dark |
Gets a system-defined Brush object. |
Dark |
Gets a system-defined Brush object. |
Dark |
Gets a system-defined Brush object. |
Dark |
Gets a system-defined Brush object. |
Dark |
Gets a system-defined Brush object. |
Dark |
Gets a system-defined Brush object. |
Dark |
Gets a system-defined Brush object. |
Dark |
Gets a system-defined Brush object. |
Dark |
Gets a system-defined Brush object. |
Dark |
Gets a system-defined Brush object. |
Dark |
Gets a system-defined Brush object. |
Dark |
Gets a system-defined Brush object. |
Dark |
Gets a system-defined Brush object. |
Deep |
Gets a system-defined Brush object. |
Deep |
Gets a system-defined Brush object. |
Dim |
Gets a system-defined Brush object. |
Dodger |
Gets a system-defined Brush object. |
Firebrick |
Gets a system-defined Brush object. |
Floral |
Gets a system-defined Brush object. |
Forest |
Gets a system-defined Brush object. |
Fuchsia |
Gets a system-defined Brush object. |
Gainsboro |
Gets a system-defined Brush object. |
Ghost |
Gets a system-defined Brush object. |
Gold |
Gets a system-defined Brush object. |
Goldenrod |
Gets a system-defined Brush object. |
Gray |
Gets a system-defined Brush object. |
Green |
Gets a system-defined Brush object. |
Green |
Gets a system-defined Brush object. |
Honeydew |
Gets a system-defined Brush object. |
Hot |
Gets a system-defined Brush object. |
Indian |
Gets a system-defined Brush object. |
Indigo |
Gets a system-defined Brush object. |
Ivory |
Gets a system-defined Brush object. |
Khaki |
Gets a system-defined Brush object. |
Lavender |
Gets a system-defined Brush object. |
Lavender |
Gets a system-defined Brush object. |
Lawn |
Gets a system-defined Brush object. |
Lemon |
Gets a system-defined Brush object. |
Light |
Gets a system-defined Brush object. |
Light |
Gets a system-defined Brush object. |
Light |
Gets a system-defined Brush object. |
Light |
Gets a system-defined Brush object. |
Light |
Gets a system-defined Brush object. |
Light |
Gets a system-defined Brush object. |
Light |
Gets a system-defined Brush object. |
Light |
Gets a system-defined Brush object. |
Light |
Gets a system-defined Brush object. |
Light |
Gets a system-defined Brush object. |
Light |
Gets a system-defined Brush object. |
Light |
Gets a system-defined Brush object. |
Light |
Gets a system-defined Brush object. |
Lime |
Gets a system-defined Brush object. |
Lime |
Gets a system-defined Brush object. |
Linen |
Gets a system-defined Brush object. |
Magenta |
Gets a system-defined Brush object. |
Maroon |
Gets a system-defined Brush object. |
Medium |
Gets a system-defined Brush object. |
Medium |
Gets a system-defined Brush object. |
Medium |
Gets a system-defined Brush object. |
Medium |
Gets a system-defined Brush object. |
Medium |
Gets a system-defined Brush object. |
Medium |
Gets a system-defined Brush object. |
Medium |
Gets a system-defined Brush object. |
Medium |
Gets a system-defined Brush object. |
Medium |
Gets a system-defined Brush object. |
Midnight |
Gets a system-defined Brush object. |
Mint |
Gets a system-defined Brush object. |
Misty |
Gets a system-defined Brush object. |
Moccasin |
Gets a system-defined Brush object. |
Navajo |
Gets a system-defined Brush object. |
Navy |
Gets a system-defined Brush object. |
Old |
Gets a system-defined Brush object. |
Olive |
Gets a system-defined Brush object. |
Olive |
Gets a system-defined Brush object. |
Orange |
Gets a system-defined Brush object. |
Orange |
Gets a system-defined Brush object. |
Orchid |
Gets a system-defined Brush object. |
Pale |
Gets a system-defined Brush object. |
Pale |
Gets a system-defined Brush object. |
Pale |
Gets a system-defined Brush object. |
Pale |
Gets a system-defined Brush object. |
Papaya |
Gets a system-defined Brush object. |
Peach |
Gets a system-defined Brush object. |
Peru |
Gets a system-defined Brush object. |
Pink |
Gets a system-defined Brush object. |
Plum |
Gets a system-defined Brush object. |
Powder |
Gets a system-defined Brush object. |
Purple |
Gets a system-defined Brush object. |
Red |
Gets a system-defined Brush object. |
Rosy |
Gets a system-defined Brush object. |
Royal |
Gets a system-defined Brush object. |
Saddle |
Gets a system-defined Brush object. |
Salmon |
Gets a system-defined Brush object. |
Sandy |
Gets a system-defined Brush object. |
Sea |
Gets a system-defined Brush object. |
Sea |
Gets a system-defined Brush object. |
Sienna |
Gets a system-defined Brush object. |
Silver |
Gets a system-defined Brush object. |
Sky |
Gets a system-defined Brush object. |
Slate |
Gets a system-defined Brush object. |
Slate |
Gets a system-defined Brush object. |
Snow |
Gets a system-defined Brush object. |
Spring |
Gets a system-defined Brush object. |
Steel |
Gets a system-defined Brush object. |
Tan |
Gets a system-defined Brush object. |
Teal |
Gets a system-defined Brush object. |
Thistle |
Gets a system-defined Brush object. |
Tomato |
Gets a system-defined Brush object. |
Transparent |
Gets a system-defined Brush object. |
Turquoise |
Gets a system-defined Brush object. |
Violet |
Gets a system-defined Brush object. |
Wheat |
Gets a system-defined Brush object. |
White |
Gets a system-defined Brush object. |
White |
Gets a system-defined Brush object. |
Yellow |
Gets a system-defined Brush object. |
Yellow |
Gets a system-defined Brush object. |
Termék | Verziók |
---|---|
.NET | 8 (package-provided), 9 (package-provided) |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
.NET-visszajelzés
A(z) .NET egy nyílt forráskód projekt. Visszajelzés adásához válasszon egy hivatkozást: