Click here to Skip to main content
15,885,278 members
Articles / Desktop Programming / MFC

Automatic Resizing of a FormView Based Application When the User Toggles the Control Bars On or Off

Rate me:
Please Sign up or sign in to vote.
4.00/5 (12 votes)
26 Feb 2004CPOL2 min read 127.5K   2.2K   36  
Explains how to implement an application which automatically resizes itself when the user toggles the control bars on or off.
// MyFormView.h : interface of the CMyFormView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_MYFORMVIEW_H__6486BCB1_7B0C_4592_9AC0_1B0BC158C1FE__INCLUDED_)
#define AFX_MYFORMVIEW_H__6486BCB1_7B0C_4592_9AC0_1B0BC158C1FE__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


class CMyFormView : public CFormView
{
protected: // create from serialization only
	CMyFormView();
	DECLARE_DYNCREATE(CMyFormView)

public:
	//{{AFX_DATA(CMyFormView)
	enum{ IDD = IDD_FRAMERESIZE_FORM };
		// NOTE: the ClassWizard will add data members here
	//}}AFX_DATA

// Attributes
public:
	CMyDoc* GetDocument();

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMyFormView)
	public:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void OnInitialUpdate(); // called first time after construct
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CMyFormView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CMyFormView)
		// NOTE - the ClassWizard will add and remove member functions here.
		//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in MyFormView.cpp
inline CMyDoc* CMyFormView::GetDocument()
   { return (CMyDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MYFORMVIEW_H__6486BCB1_7B0C_4592_9AC0_1B0BC158C1FE__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United States United States
I'm a software developer from Sweden who got tired of snow and cold weather and moved to USA. I choose New York City, so I wouldn't totally miss out on snow and cold weather. I work on Wall Street with financial systems (not much else to do in this neighborhood). I primarily use Visual C++/MFC or C#/.NET as development tool.

The picture is of my wife and me in Cannes, France, drinking the most expensive Coke we ever had.

Comments and Discussions