CCtrlView Class

 

For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

For the latest documentation on Visual Studio 2017, see CCtrlView Class on docs.microsoft.com. Adapts the document-view architecture to the common controls supported by Windows 98 and Windows NT versions 3.51 and later.

class CCtrlView : public CView  

Public Constructors

NameDescription
CCtrlView::CCtrlViewConstructs a CCtrlView object.

Protected Methods

NameDescription
CCtrlView::OnDrawCalled by the framework to draw using the specified device context.
CCtrlView::PreCreateWindowCalled before the creation of the Windows window attached to this CCtrlView object.

Protected Data Members

NameDescription
CCtrlView::m_dwDefaultStyleContains the default style for the view class.
CCtrlView::m_strClassContains the Windows class name for the view class.

The class CCtrlView and its derivatives, CEditView, CListView, CTreeView, and CRichEditView, adapt the document-view architecture to the new common controls supported by Windows 95/98 and Windows NT versions 3.51 and later. For more information on the document-view architecture, see Document/View Architecture.

CObject

CCmdTarget

CWnd

CView

CCtrlView

Header: afxwin.h

Constructs a CCtrlView object.

CCtrlView(
    LPCTSTR lpszClass,  
    DWORD dwStyle);

Parameters

lpszClass
Windows class name of the view class.

dwStyle
Style of the view class.

Remarks

The framework calls the constructor when a new frame window is created or a window is split. Override CView::OnInitialUpdate to initialize the view after the document is attached. Call CWnd::Create or CWnd::CreateEx to create the Windows object.

Contains the Windows class name for the view class.

CString m_strClass;  

Contains the default style for the view class.

DWORD m_dwDefaultStyle;  

Remarks

This style is applied when a window is created.

Called by the framework to draw the contents of the CCtrlView object using the specified device context.

virtual void OnDraw(CDC* pDC);

Parameters

pDC
A pointer to the device context in which the drawing occurs.

Remarks

OnDraw is typically called for screen display, passing a screen device context specified by pDC.

Called before the creation of the Windows window attached to this CWnd object.

virtual BOOL PreCreateWindow(CREATESTRUCT& cs);

Parameters

cs
A CREATESTRUCT structure.

Return Value

Nonzero if the window creation should continue; 0 to indicate creation failure.

Remarks

Never call this function directly.

The default implementation of this function checks for a NULL window class name and substitutes an appropriate default. Override this member function to modify the CREATESTRUCT structure before the window is created.

Each class derived from CCtrlView adds its own functionality to its override of PreCreateWindow. By design, these derivations of PreCreateWindow are not documented. To determine the styles appropriate to each class and the interdependencies between the styles, you can examine the MFC source code for your application's base class. If you choose to override PreCreateWindow, you can determine whether the styles used in your application's base class provide the functionality you need by using information gathered from the MFC source code.

For more information on changing window styles, see the Changing the Styles of a Window Created by MFC.

CView Class
Hierarchy Chart
CTreeView Class
CListView Class
CRichEditView Class

Show: