MFC Library Reference CView::OnDraw See Also CView Overview | Class Members | Hierarchy Chart | CDC::IsPrinting | CDC::RectVisible | CView::OnPrint | CWnd::OnCreate | CWnd::OnDestroy | CWnd::PostNcDestroy 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. Res 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.
CView::OnDraw This method is called by the framework to render an image of the document. The framework calls this method to perform screen display, printing, and print preview, and it passes a different device context in each case. There is no default implementation.virtual void OnDraw( CDC* pDC ) = 0; Parameters pDC Points to the device context to be used for rendering an image of the document. CWnd::Create This method creates a Windows CE child window and attaches it to the CWnd object.You construct a child window in two steps. First, call the constructor, which constructs the CWnd object. Then call Create, which creates the Windows child window and attaches it to CWnd. Create initializes the window class name and window name and registers values for its style, parent, and ID.virtual BOOL Create ( LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL ); Parameters lpszClassName Points to a null-terminated character string that names the Windows class, that is, a WNDCLASS structure. The class name can be any name registered with the global AfxRegisterWndClass function or any of the predefined control-class names. If NULL, uses the default CWnd attributes. lpszWindowName Points to a null-terminated character string that contains the window name. dwStyle Specifies the window style attributes. WS_POPUP cannot be used. If you wish to create a pop-up window, use CWnd::CreateEx instead. rect Specifies the size and position of the window, in client coordinates of pParentWnd. pParentWnd Specifies the parent window. nID Specifies the ID of the child window. pContext Specifies the create context of the window. Return Value Nonzero if it is successful; otherwise, it is zero.
CView Overview | Class Members | Hierarchy Chart | CDC::IsPrinting | CDC::RectVisible | CView::OnPrint | CWnd::OnCreate | CWnd::OnDestroy | CWnd::PostNcDestroy
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.
Res
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.
This method is called by the framework to render an image of the document. The framework calls this method to perform screen display, printing, and print preview, and it passes a different device context in each case. There is no default implementation.virtual void OnDraw(
CDC* pDC ) = 0;
Parameters
pDC
Points to the device context to be used for rendering an image of the document. CWnd::Create
This method creates a Windows CE child window and attaches it to the CWnd object.You construct a child window in two steps. First, call the constructor, which constructs the CWnd object. Then call Create, which creates the Windows child window and attaches it to CWnd. Create initializes the window class name and window name and registers values for its style, parent, and ID.virtual BOOL Create (
LPCTSTR lpszClassName,
LPCTSTR lpszWindowName,
DWORD dwStyle,
const RECT& rect,
CWnd* pParentWnd,
UINT nID,
CCreateContext* pContext = NULL );
Parameters
lpszClassName
Points to a null-terminated character string that names the Windows class, that is, a WNDCLASS structure. The class name can be any name registered with the global AfxRegisterWndClass function or any of the predefined control-class names. If NULL, uses the default CWnd attributes.
lpszWindowName
Points to a null-terminated character string that contains the window name.
dwStyle
Specifies the window style attributes. WS_POPUP cannot be used. If you wish to create a pop-up window, use CWnd::CreateEx instead.
rect
Specifies the size and position of the window, in client coordinates of pParentWnd.
pParentWnd
Specifies the parent window.
nID
Specifies the ID of the child window.
pContext
Specifies the create context of the window.
Return Value
Nonzero if it is successful; otherwise, it is zero.