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

Screen Designer Classes

Rate me:
Please Sign up or sign in to vote.
4.93/5 (39 votes)
7 Mar 20045 min read 147.4K   3.9K   109  
Screen Designer Classes for MFC applications
// Copyright � 2002 Oink!
// FILE NAME	: DynControl.h
// DESCRIPTION	: Class control dynamically screen created controls
//
// PROGRAMMER	DATE		PATCH	DESCRIPTION
// ============	===========	=======	===============================================

#if !defined(AFX_DYNCONTROL_H__34FE9A1D_7A03_4FCC_BE39_D6BDBC0AF8F9__INCLUDED_)
#define AFX_DYNCONTROL_H__34FE9A1D_7A03_4FCC_BE39_D6BDBC0AF8F9__INCLUDED_

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

class CDynControl  
{
public:
	CDynControl(CWnd* pWnd, int nControlType, int nID, BOOL bDynamic);
	virtual ~CDynControl();

// Attributes
private:
	BOOL m_bRectInit;
	CFont m_fontDefault;
	CWnd* m_pWnd;
	HWND m_hWnd;
	CRect m_Rect;
	long m_nID;	
	CWnd* m_pParentWnd;
	long m_nControlType;
	BOOL m_bDynamic;
	BOOL m_bVisible;
	CString m_strValue;
	long m_nFieldID;
	BOOL m_Group;
	int m_nTabOrder;
	int m_nRadioValue;
	CString m_strComboValues;

public:

	int m_x;
	int m_y;
	int m_cx;
	int m_cy;
	int m_Originalx;
	int m_Originaly;
	int m_Originalcx;
	int m_Originalcy;
	CString m_Originalvalue;

// Operations
public:
	void EnableWindow(BOOL bEnable);
	void AddControl(CPoint* ppoint);
	void AddControl();
	CRect GetRect();
	void CopyRect(LPRECT rect);
	int GetID() { return m_nID; }
	int GetControlType() { return m_nControlType; }
	CWnd* GetParent() { return m_pParentWnd; }
	BOOL GetDynamic() { return m_bDynamic; }
	void ResetSane() { m_x = m_Originalx; m_y = m_Originaly; m_cx = m_Originalcx; m_cy = m_Originalcy; m_strValue = m_Originalvalue; }
	void SetRectInit() { m_bRectInit = TRUE; }

	// general control properties
	BOOL GetVisible() { return m_bVisible; }
	void SetVisible(BOOL bVisible) { m_bVisible = bVisible; } 
	CString GetText() { return m_strValue; }
	void SetText(CString strText) { m_strValue = strText; }
	int GetFieldID() { return m_nFieldID; }
	void SetFieldID(long nFieldID) { m_nFieldID = nFieldID; }
	BOOL GetGroup() { return m_Group; }
	void SetGroup(BOOL bGroup) { m_Group = bGroup; } 
	int GetTabOrder() { return m_nTabOrder; }
	void SetTabOrder(int nTabOrder) { m_nTabOrder = nTabOrder; }
	int GetRadioValue() { return m_nRadioValue; }
	void SetRadioValue(int nRadioValue) { m_nRadioValue = nRadioValue; }
	CString GetComboValues() { return m_strComboValues; }
	void SetComboValues(CString strComboValues) { m_strComboValues = strComboValues; }

};

#endif // !defined(AFX_DYNCONTROL_H__34FE9A1D_7A03_4FCC_BE39_D6BDBC0AF8F9__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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions