1. Drawing-related
Drawing device DC (device context), drawing context/Drawing Description table
HDC-DC handle, representing the drawing device
Gdi-windows Graphics Device Interface,win32 provides a drawing API
2. Color
(1) The expression of color
Computer use red, green, blue: R-0 ~ 255
G-0 ~ 255
B-0 ~ 255
Each color dot is 3 bytes 24 bits, save 0-2^24-1
16-bit: 5, 5, 6-red, green, blue
32-bit: 8, 8, 8, 8-red, green, blue, transparency
(2) Use of color
COLORREF-Actual DWORD, for example: colorref ncolor = 0;
Assign values using RGB macros, for example: Ncolor = RGB (0, 0, 255);
Gets the RGB value, Getrvalue/getgvalue/getbvalue, for example: BYTE nred = Getrvalue (Ncolor);
3. Use of points
(1) GetPixel gets the color of the specified point
COLORREF GetPixel (HDC hdc,//
int Nxpos,//
int nypos); //
(2) SetPixel set the specified color
COLORREF SetPixel (HDC hdc,//
int X,//
int Y,//
COLORREF crcolor); //
Returns the original color of the point
4. Use of lines (lines, arcs)
Moves the current point to the specified point: BOOL movetoex (HDC hdc,
int X,
int Y,
Lppoint lppoint);
Draws a line from the current point to the specified point: BOOL LineTo (HDC hdc,
int Nxend,
int nyend);
14.Windows Drawing