CFormView Class with Custom Background Color

CColorFormView is derived from CFormView with custom background color.

How to use CColorFormView class in your project?

1)Derive your form view class from CColorFormView class. For example:

class CMyFormView : public CColorFormView
2)Change form view background color: You can specify background color in your form view's OnInitialUpdate():

void CMyFormViewView::OnInitialUpdate()
{
 SetWindowText(_T("This is my formview"));

 CColorFormView::OnInitialUpdate();

 // set color to your form view
 SetBackgroundColor(RGB(0, 128, 0));

 // make the parent frame fit the form template
 GetParentFrame()->RecalcLayout();
 ResizeParentToFit();
}

I hope you enjoy this little class.

Download demo project – 31 KB

Download source – 2 KB

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read