Condividi tramite


CView::OnDraw

Called by the framework to render an image of the document.

virtual void OnDraw(
   CDC* pDC 
) = 0;

Parameters

  • pDC
    Points to the device context to be used for rendering an image of the document.

Remarks

The framework calls this function to perform screen display, printing, and print preview, and it passes a different device context in each case. There is no default implementation.

You must override this function to display your view of the document. You can make graphic device interface (GDI) calls using the CDC object pointed to by the pDC parameter. You can select GDI resources, such as pens or fonts, into the device context before drawing and then deselect them afterwards. Often your drawing code can be device-independent; that is, it doesn't require information about what type of device is displaying the image.

To optimize drawing, call the RectVisible member function of the device context to find out whether a given rectangle will be drawn. If you need to distinguish between normal screen display and printing, call the IsPrinting member function of the device context.

Requirements

Header: afxwin.h

See Also

Concepts

CView Class

CView Members

Hierarchy Chart

CDC::IsPrinting

CDC::RectVisible

CView::OnPrint

CWnd::OnCreate

CWnd::OnDestroy

CWnd::PostNcDestroy