O'Reilly logo

Windows Forms Programming in C# by Chris Sells

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Colors

So far, I've been drawing the ellipse in my form using a built-in dark blue brush. A brush, as you'll see, is for filling the interior of a shape, whereas a pen is used to draw the edge of a shape. Either way, suppose I'm not quite happy with the dark blue brush. Instead, I'd like a brush of one of the more than 16 million colors that doesn't come prebuilt for me, and this means that I first need to specify the color in which I'm interested. Color is modeled in .NET via the Color structure:

 struct Color { // No color public static readonly Color Empty; // Built-in colors public static Color AliceBlue { get; } // ... public static Color YellowGreen { get; } // Properties public byte A { get; } public byte B { get; } public byte G { get; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required