1. Paint Brush
There are two ways to create a paint brush
First, call the getstockobject () function directly.
Second, you can call it by creating a paint brush.
Hpen createpen (
Int Fnpenstyle , // Pen style
Int Nwidth , // Pen width
Colorref Crcolor // Pen color
);
After creating a paint brush, you must call the SelectObject function to select the device environment;
You can use the deleteobject function to delete a paint brush;
2. Image painter
Create a paint brush
First, call the getstockobject function.
The second is to create a paint brush by calling createsolidbrush and createhatchbrush.
hbrush createsolidbrush (colorref crcolor // brush color value );
Hbrush createhatchbrush (intFnstyle,// Hatch StyleColorrefClrref// Color value);
3. Color
Implemented through RGB functions;
4. Commonly Used plotting Functions
Sets the current position of the paint brush function movetoex.
bool movetoex (HDC HDC , // handle to device context int x , // X-coordinate of New Current Position int Y , // y-coordinate of New Current Position lppoint // pointer to old current position );
the lineto function that draws a straight line from the current position to the specified coordinate point
bool lineto (HDC HDC , // device context handle int nxend , // X-coordinate of line's ending point int nyend // y-coordinate of line's ending point );
Start from the current position and use a line segment to connect to the polyline function of each point specified in lppoints
bool polyline (HDC HDC , // handle to device context const point * lppt , // pointer to array containing endpoints int cpoints // number of points in the array );
Elliptical Arc
Bool arc (HDC HDC , // Handle to device context Int Nleftrect , // X-coord of bounding rectangle's upper-left corner Int Ntoprect , // Y-coord of bounding rectangle's upper-left corner Int Nrightrect , // X-coord of bounding rectangle's lower-right corner Int Nbottomrect , // Y-coord of bounding rectangle's lower-right corner Int Nxstartarc , // First radial ending pointInt Nystartarc , // First radial ending point Int Nxendarc , // Second radial ending point Int Nyendarc // Second radial ending point );
Draw a pie chart and fill the pie with the current paint brush
Bool pie (HDC HDC , // Handle to device context Int Nleftrect , // X-coord of bounding rectangle's upper-left corner Int Ntoprect , // Y-coord of bounding rectangle's upper-left corner Int Nrightrect , // X-coord of bounding rectangle's lower-right corner Int Nbottomrect , // Y-coord of bounding rectangle's lower-right corner Int Nxradial1 , // X-coord of first radial's endpointInt Nyradial1 , // Y-coord of first radial's endpoint Int Nxradial , // X-coord of second radial's endpoint Int Nyradial // Y-coord of second radial's endpoint );
Draw a rectangle and fill the rectangle
Bool rectangle (HDC HDC , // Handle to device context Int Nleftrect , // X-coord of bounding rectangle's upper-left corner Int Ntoprect , // Y-coord of bounding rectangle's upper-left corner Int Nrightrect , // X-coord of bounding rectangle's lower-right corner Int Nbottomrect // Y-coord of bounding rectangle's lower-right corner );
Draw an ellipse and fill Ellipse
Bool ellipse (HDC HDC , // Handle to device context Int Nleftrect , // X-coord of bounding rectangle's upper-left corner Int Ntoprect , // Y-coord of bounding rectangle's upper-left corner Int Nrightrect , // X-coord of bounding rectangle's lower-right corner Int Nbottomrect // Y-coord of bounding rectangle's lower-right corner );
Draw a polygon and fill it with polygon
bool polygon (HDC HDC , // handle to device context const point * lppoints , // pointer to Polygon's vertices int ncount // count of Polygon's vertices );
the invalidaterect function is used to refresh the user zone (to make the region invalid)