1.GDI Drawing objects-brushes
(1) function
Line color, linetype, line thickness
(2) Use
A. Creating a handle
Hpen CreatePen (int fnpenstyle,//Brush style
int nwidth,//thickness of brush
COLORREF crcolor); The color of the brush
Successful, returns the brush handle
Brush style: ps_solid-solid line, can support multiple pixel width, other linetype can only be one pixel wide
Ps_dash-Dashed line
Ps_dot-Dot Line
Ps_dashdot-a dashed line and a point alternately appear
Ps_dashdotdot-dashed and two dots alternately appear
B. Applying a brush to a DC
Hgdiobj SelectObject (HDC hdc,//drawing device handle
Hgdiobj hgdiobj); GDI drawing object handle, brush handle
Successful, returns the original GDI drawing object handle (note the brush that saved the original DC).
C. Drawing
D. Remove the brushes from the DC
Putting the original brush in the device DC with the SelectObject function will remove the brush we created.
E. Releasing brushes
BOOL DeleteObject (Hgdiobj hobject);
You can only delete brushes that are not used by the DC, so you must remove the brush from the DC before releasing it
15.windows Drawing (ii)