Brushes 类

定义

所有标准颜色的画笔。 此类不能被继承。

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
继承
Brushes

示例

下面的代码示例演示如何使用类的成员 Brushes 填充 a Rectangle. 此示例应与Windows窗体一起使用。 将此代码粘贴到窗体中,并在处理表单 Paint 的事件时调用此方法,并传递 ePaintEventArgs

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

注解

Brushes 类包含 static 只读属性,这些属性返回 Brush 由属性名称指示的颜色对象。 通常不必显式释放此类中的属性返回的画笔,除非它用于构造新画笔。 有关此类中画笔所表示的颜色的详细信息,请参阅 按名称列出的颜色列表

注释

在 .NET 6 及更高版本中,包含此类型的 System.Drawing.Common 包 仅支持在 Windows 操作系统上运行。 在跨平台应用中使用此类型会导致编译时警告和运行时异常。 有关详细信息,请参阅 仅在 Windows 上支持的 System.Drawing.Common。

属性

名称 说明
AliceBlue

获取系统定义 Brush 的对象。

AntiqueWhite

获取系统定义 Brush 的对象。

Aqua

获取系统定义 Brush 的对象。

Aquamarine

获取系统定义 Brush 的对象。

Azure

获取系统定义 Brush 的对象。

Beige

获取系统定义 Brush 的对象。

Bisque

获取系统定义 Brush 的对象。

Black

获取系统定义 Brush 的对象。

BlanchedAlmond

获取系统定义 Brush 的对象。

Blue

获取系统定义 Brush 的对象。

BlueViolet

获取系统定义 Brush 的对象。

Brown

获取系统定义 Brush 的对象。

BurlyWood

获取系统定义 Brush 的对象。

CadetBlue

获取系统定义 Brush 的对象。

Chartreuse

获取系统定义 Brush 的对象。

Chocolate

获取系统定义 Brush 的对象。

Coral

获取系统定义 Brush 的对象。

CornflowerBlue

获取系统定义 Brush 的对象。

Cornsilk

获取系统定义 Brush 的对象。

Crimson

获取系统定义 Brush 的对象。

Cyan

获取系统定义 Brush 的对象。

DarkBlue

获取系统定义 Brush 的对象。

DarkCyan

获取系统定义 Brush 的对象。

DarkGoldenrod

获取系统定义 Brush 的对象。

DarkGray

获取系统定义 Brush 的对象。

DarkGreen

获取系统定义 Brush 的对象。

DarkKhaki

获取系统定义 Brush 的对象。

DarkMagenta

获取系统定义 Brush 的对象。

DarkOliveGreen

获取系统定义 Brush 的对象。

DarkOrange

获取系统定义 Brush 的对象。

DarkOrchid

获取系统定义 Brush 的对象。

DarkRed

获取系统定义 Brush 的对象。

DarkSalmon

获取系统定义 Brush 的对象。

DarkSeaGreen

获取系统定义 Brush 的对象。

DarkSlateBlue

获取系统定义 Brush 的对象。

DarkSlateGray

获取系统定义 Brush 的对象。

DarkTurquoise

获取系统定义 Brush 的对象。

DarkViolet

获取系统定义 Brush 的对象。

DeepPink

获取系统定义 Brush 的对象。

DeepSkyBlue

获取系统定义 Brush 的对象。

DimGray

获取系统定义 Brush 的对象。

DodgerBlue

获取系统定义 Brush 的对象。

Firebrick

获取系统定义 Brush 的对象。

FloralWhite

获取系统定义 Brush 的对象。

ForestGreen

获取系统定义 Brush 的对象。

Fuchsia

获取系统定义 Brush 的对象。

Gainsboro

获取系统定义 Brush 的对象。

GhostWhite

获取系统定义 Brush 的对象。

Gold

获取系统定义 Brush 的对象。

Goldenrod

获取系统定义 Brush 的对象。

Gray

获取系统定义 Brush 的对象。

Green

获取系统定义 Brush 的对象。

GreenYellow

获取系统定义 Brush 的对象。

Honeydew

获取系统定义 Brush 的对象。

HotPink

获取系统定义 Brush 的对象。

IndianRed

获取系统定义 Brush 的对象。

Indigo

获取系统定义 Brush 的对象。

Ivory

获取系统定义 Brush 的对象。

Khaki

获取系统定义 Brush 的对象。

Lavender

获取系统定义 Brush 的对象。

LavenderBlush

获取系统定义 Brush 的对象。

LawnGreen

获取系统定义 Brush 的对象。

LemonChiffon

获取系统定义 Brush 的对象。

LightBlue

获取系统定义 Brush 的对象。

LightCoral

获取系统定义 Brush 的对象。

LightCyan

获取系统定义 Brush 的对象。

LightGoldenrodYellow

获取系统定义 Brush 的对象。

LightGray

获取系统定义 Brush 的对象。

LightGreen

获取系统定义 Brush 的对象。

LightPink

获取系统定义 Brush 的对象。

LightSalmon

获取系统定义 Brush 的对象。

LightSeaGreen

获取系统定义 Brush 的对象。

LightSkyBlue

获取系统定义 Brush 的对象。

LightSlateGray

获取系统定义 Brush 的对象。

LightSteelBlue

获取系统定义 Brush 的对象。

LightYellow

获取系统定义 Brush 的对象。

Lime

获取系统定义 Brush 的对象。

LimeGreen

获取系统定义 Brush 的对象。

Linen

获取系统定义 Brush 的对象。

Magenta

获取系统定义 Brush 的对象。

Maroon

获取系统定义 Brush 的对象。

MediumAquamarine

获取系统定义 Brush 的对象。

MediumBlue

获取系统定义 Brush 的对象。

MediumOrchid

获取系统定义 Brush 的对象。

MediumPurple

获取系统定义 Brush 的对象。

MediumSeaGreen

获取系统定义 Brush 的对象。

MediumSlateBlue

获取系统定义 Brush 的对象。

MediumSpringGreen

获取系统定义 Brush 的对象。

MediumTurquoise

获取系统定义 Brush 的对象。

MediumVioletRed

获取系统定义 Brush 的对象。

MidnightBlue

获取系统定义 Brush 的对象。

MintCream

获取系统定义 Brush 的对象。

MistyRose

获取系统定义 Brush 的对象。

Moccasin

获取系统定义 Brush 的对象。

NavajoWhite

获取系统定义 Brush 的对象。

Navy

获取系统定义 Brush 的对象。

OldLace

获取系统定义 Brush 的对象。

Olive

获取系统定义 Brush 的对象。

OliveDrab

获取系统定义 Brush 的对象。

Orange

获取系统定义 Brush 的对象。

OrangeRed

获取系统定义 Brush 的对象。

Orchid

获取系统定义 Brush 的对象。

PaleGoldenrod

获取系统定义 Brush 的对象。

PaleGreen

获取系统定义 Brush 的对象。

PaleTurquoise

获取系统定义 Brush 的对象。

PaleVioletRed

获取系统定义 Brush 的对象。

PapayaWhip

获取系统定义 Brush 的对象。

PeachPuff

获取系统定义 Brush 的对象。

Peru

获取系统定义 Brush 的对象。

Pink

获取系统定义 Brush 的对象。

Plum

获取系统定义 Brush 的对象。

PowderBlue

获取系统定义 Brush 的对象。

Purple

获取系统定义 Brush 的对象。

Red

获取系统定义 Brush 的对象。

RosyBrown

获取系统定义 Brush 的对象。

RoyalBlue

获取系统定义 Brush 的对象。

SaddleBrown

获取系统定义 Brush 的对象。

Salmon

获取系统定义 Brush 的对象。

SandyBrown

获取系统定义 Brush 的对象。

SeaGreen

获取系统定义 Brush 的对象。

SeaShell

获取系统定义 Brush 的对象。

Sienna

获取系统定义 Brush 的对象。

Silver

获取系统定义 Brush 的对象。

SkyBlue

获取系统定义 Brush 的对象。

SlateBlue

获取系统定义 Brush 的对象。

SlateGray

获取系统定义 Brush 的对象。

Snow

获取系统定义 Brush 的对象。

SpringGreen

获取系统定义 Brush 的对象。

SteelBlue

获取系统定义 Brush 的对象。

Tan

获取系统定义 Brush 的对象。

Teal

获取系统定义 Brush 的对象。

Thistle

获取系统定义 Brush 的对象。

Tomato

获取系统定义 Brush 的对象。

Transparent

获取系统定义 Brush 的对象。

Turquoise

获取系统定义 Brush 的对象。

Violet

获取系统定义 Brush 的对象。

Wheat

获取系统定义 Brush 的对象。

White

获取系统定义 Brush 的对象。

WhiteSmoke

获取系统定义 Brush 的对象。

Yellow

获取系统定义 Brush 的对象。

YellowGreen

获取系统定义 Brush 的对象。

适用于