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

MFC/C++ Helper Class for Window Resizing

Rate me:
Please Sign up or sign in to vote.
4.91/5 (139 votes)
21 Oct 2014CPOL25 min read 659.2K   18.2K   385  
Gives you total control when it comes to resizing windows
#pragma once
#include "WndResizer.h"

// CExample10Dlg dialog

class CExample10Dlg : public CDialog
{
	DECLARE_DYNAMIC(CExample10Dlg)

public:
	CExample10Dlg(CWnd* pParent = NULL);   // standard constructor
	virtual ~CExample10Dlg();

// Dialog Data
	enum { IDD = IDD_EX10_DLG };

private:
  CWndResizer m_resizer;
  CFormView * m_pView;
private:
  CFormView * CreateFormViewOnTheFly();
protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()
public:
  virtual BOOL OnInitDialog();
  afx_msg void OnDestroy();
};
#pragma once



// CTestView form view

class CTestView : public CFormView
{
	DECLARE_DYNCREATE(CTestView)

protected:
	CTestView();           // protected constructor used by dynamic creation
	virtual ~CTestView();

public:
	enum { IDD = IDD_EX10_VIEW };
#ifdef _DEBUG
	virtual void AssertValid() const;
#ifndef _WIN32_WCE
	virtual void Dump(CDumpContext& dc) const;
#endif
#endif

private:
  CWndResizer m_resizer;
  CSize m_szDesignTimeSize;
public:
  void SetupResizer();
protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()
public:
  virtual void OnInitialUpdate();
  afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
};


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
Denmark Denmark
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions