Createcompatibledc
This function creates a memory device context environment (DC) compatible with the specified device ).
Prototype:
HDC createcompatibledc (HDCHDC);
Parameters:
HDC: [in] handle of the context environment of an existing device. If this handle is null, this function createsProgramThe current display is compatible with the memory device context environment.
Return Value:
If the operation succeeds, the handle of the memory device context is returned. If the operation fails, the return value is null. To obtain more error information, call the getlasterror function.
Note:
The memory device context environment is a device context environment that only exists in the memory. When the memory device context environment is created, its display interface is a standard monochrome pixel width and a monochrome pixel height. Before an application can use the memory device context for plotting, it must select a bitmap with the correct height and width to the device context.CreatecompatiblebitmapThe function specifies a combination of height, width, and color to meet the function call needs.
When a memory device context is created, all features are set to the default value. The memory device context is used as a normal device context. Of course, you can also set these features to non-default values, obtain the current settings of its features and select a paint brush, brush, and area for it.
CreatecompatibledcThe function is only applicable to devices that support grating operations. Applications can callGetdevicecapsFunction to determine whether a device supports these operations.
This parameter can be called when the memory device context is no longer needed.DeletedcFunction to delete it.
Example:
// Hdcexist: handle to an existing device context
// Create DC compatible with hdcexist.
Hdccanvas = Createcompatibledc ( Hdcexist );
If ( HDC = Null )
Return ;
// Create compatible hbitmap
Hbcanvas=Createcompatiblebitmap(Hdcskin,Screenwidth,Screenheight);
// Select hbitmap into DC
SelectObject(Hdccanvas,Hbcanvas);
Refer:
Interactive Encyclopedia: createcompatibledc
Msdn: createcompatibledc