CMemDC Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

A helper class for a memory device context. The memory device context supports offscreen drawing.

class CMemDC

Members

Public Constructors

Name

Description

CMemDC::CMemDC

Constructs and initializes a CMemDC object.

CMemDC::~CMemDC

Copies content from the memory device context to the screen. Also destructs the CMemDC object.

Public Methods

Name

Description

CMemDC::GetDC

Returns a device context that you can use for subsequent drawing operations.

CMemDC::IsMemDC

Indicates whether the device context returned by GetDC is a memory device context.

CMemDC::IsVistaDC

Indicates whether buffered painting is available.

Remarks

This class supports the MFC framework infrastructure and is not intended to be used directly from your code.

Use CMemDC for drawing offscreen on a memory device context. The results are copied to the screen device context by the destructor, CMemDC::~CMemDC.

This class automatically uses buffered painting: a feature of Windows Vista.

Example

The following example demonstrates how to use the class CMemDC. The example creates a CMemDC object and sets its color and background mode.

    // this points to CMainFrame
    // CDC* pDCPaint;
    // pDCPaint = NULL;
    // CMemDC memDC(*pDCPaint, this);
    // CDC* pDC = &memDC.GetDC();

    // set the text color and the background mode
    // pDC->SetTextColor(afxGlobalData.clrBtnText);
    // pDC->SetBkMode(TRANSPARENT);

Inheritance Hierarchy

CMemDC

Requirements

Header: afxglobals.h

See Also

Reference

Hierarchy Chart

Other Resources

MFC Classes

Internal Classes (MFC Feature Pack)