Brushes in GDI+

In the .NET Framework library, the Brush class is an abstract base class, which means you cannot create an instance of it without using it's derived classes. All usable classes are inherited from the abstract Brush class.

 

Figure 4.1. Classes inherited from the Brush class

graphics/04fig01.gif

GDI+ provides four different kinds of brushes; solid, hatch, texture, gradient.

Figure 4.2. Brush types and their classes

graphics/04fig02.gif

Brushes Class

The Brushes class is a sealed class( it cannot be inherited). Brushes provides more than 140 static memebers(properties), and each of these members respesents a brush with a particular color.

Solid Brushes

A solid brush is a brush that fill an area with single solid color.

SolidBrush( Color );

Hatch Brushes

Hatch brushes are brushes with a hatch style, a foreground color, and a  background color. Hatches are a combination of rectangle lines and the area between the lines. The foreground color defines the color of lines; the background color defines the color between lines.

HatchBrush( HatchStyle, Color );

HatchBrush( HatchStyle, Color, Color );

Texture Brushes

Texture brushes allow us to use an image as a brush and fill GDI+ object with the brush. Texture brushes are useful when you need to fill a graphics object with images in a pattern such as tile.

Gradient Brushes

Linear gradient brushes allow you to blend two colors together, generating an indefinite range of shades.

LinearGradientBrush( Rectangle, Color, Color, LinearGaridentMode );

Path Gradient Brushes

A graphics path is a collection of lines and curves. In GDI+, the PathGradientBrush object fills a graphics paths with a gradient.

Like LinearGradientBrush, PathGradientBrush is a combination of two colors ,but instead of starting with one color and ending with another, PathGradientBrush starts from the center of a graphics path and ends at the outside boundary of the path.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值