1. Display the bitmap of the independent file mode (all the data of the bitmap is independent of the executable)
Hbitmap * hbitmap; // Define bitmap object handle
Bitmap BM;
CDC MEMDC;
CClientDC ClientDC (this);
Memdc.createCompatibleDC (& ClientDC);
Hbitmap = (hbitmap *) :: loadimage
(AfxGetInstanceHandle (),
// acquire the application handle
"Demo1.bmp",
// bitmap file name
Image_bitmap,
// type is Windows bitmap
0, 0,
Lr_loadfromfile;
// Net the diagram data from the file
Memdc.selectObject (hbitmap);
:: GetObject (Hbitmap, Sizeof (BM), & BM);
Clientdc.bitblt (...)
// Use the format and method
This method shows that the bitmap speed is slower than the previous one, but its flexibility is large, can change bitmap files, without removing the source program, also reduces the size of the executable.
2. Several coordinate system screen coordinate screen coordinates in Windows describe a coordinate system of physical devices (monitors, printers, etc.), coordinate origin on the upper left corner of the screen, X axis right is positive, Y axial down is positive. The unit is pixel. The origin, the direction of the coordinate axis, and the metrics are unable to change. Equipment coordinates (also known as physical coordinates) device coordinates are a coordinate system describing a form displayed or printed on the screen and printer. The default coordinate origin is in the upper left corner of its client area. X axial right is positive, and the Y axial is positive. The unit is pixel. The origin and coordinate axis direction can be changed, but the unit of measure cannot be changed. The logical coordinate logic coordinate is a coordinate system that controls the display and prints in the program. This coordinate system is closely related to the defined mapping mode. The default mapping mode is mm_text. We can change the default behavior of the coordinate system by setting different mapping modes.
3, logical is logical coordinates, Device is a device coordinate, if you look at the scroll bar, you will understand the difference between the two.
4. It is easy to confuse for the concept of viewport and window, in fact, window and viewports are associated with mapping mode: mapping mode is used to go from "window" to "viewport" (device coordinates) Mapping. "Viewport" is based on device coordinates, usually, the viewport is the same as the client area; "Window" is based on logical coordinate, and the logical coordinates can be pixels, millimeters, inches.
5. The coordinate position of the mouse coordinate in the VC is represented by device coordinate, but all GDI drawings use logical coordinates.