CFormView Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CFormView Class.

The base class used for form views.

Syntax

class CFormView : public CScrollView  

Members

Protected Constructors

Name Description
CFormView::CFormView Constructs a CFormView object.

Public Methods

Name Description
CFormView::IsInitDlgCompleted Used for synchronization during initialization.

Remarks

A form view is essentially a view that contains controls. These controls are laid out based on a dialog-template resource. Use CFormView if you want forms in your application. These views support scrolling, as needed, using the CScrollView functionality.

When you are Creating a Forms-Based Application, you can base its view class on CFormView, making it a forms-based application.

You can also insert new Form Topics into document-view-based applications. Even if your application did not initially support forms, Visual C++ will add this support when you insert a new form.

The MFC Application Wizard and the Add Class command are the preferred methods for creating forms-based applications. If you need to create a forms-based application without using these methods, see Creating a Forms-Based Application.

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CView

CScrollView

CFormView

Requirements

Header: afxext.h

CFormView::CFormView

Constructs a CFormView object.

CFormView(LPCTSTR lpszTemplateName);  
CFormView(UINT nIDTemplate);
```  
  
### Parameters  
 `lpszTemplateName`  
 Contains a null-terminated string that is the name of a dialog-template resource.  
  
 `nIDTemplate`  
 Contains the ID number of a dialog-template resource.  
  
### Remarks  
 When you create an object of a type derived from `CFormView`, invoke one of the constructors to create the view object and identify the dialog resource on which the view is based. You can identify the resource either by name (pass a string as the argument to the constructor) or by its ID (pass an unsigned integer as the argument).  
  
 The form-view window and child controls are not created until `CWnd::Create` is called. `CWnd::Create` is called by the framework as part of the document and view creation process, which is driven by the document template.  
  
> [!NOTE]
>  Your derived class *must* supply its own constructor. In the constructor, invoke the constructor, `CFormView::CFormView`, with the resource name or ID as an argument as shown in the preceding class overview.  
  
### Example  
 [!CODE [NVC_MFCDocView#90](../CodeSnippet/VS_Snippets_Cpp/NVC_MFCDocView#90)]  
  
 [!CODE [NVC_MFCDocView#91](../CodeSnippet/VS_Snippets_Cpp/NVC_MFCDocView#91)]  
  
##  <a name="cformview__isinitdlgcompleted"></a>  CFormView::IsInitDlgCompleted  
 Used by MFC to ensure that initialization is completed before performing other operations.  
  

BOOL IsInitDlgCompleted() const;

  
### Return Value  
 True if the initialization function for this dialog has completed.  
  
## See Also  
 [MFC Sample SNAPVW](../Topic/Visual%20C++%20Samples.md)   
 [MFC Sample VIEWEX](../Topic/Visual%20C++%20Samples.md)   
 [CScrollView Class](../Topic/CScrollView%20Class.md)   
 [Hierarchy Chart](../Topic/Hierarchy%20Chart.md)   
 [CDialog Class](../Topic/CDialog%20Class.md)   
 [CScrollView Class](../Topic/CScrollView%20Class.md)