Click here to Skip to main content
15,860,859 members
Articles / Desktop Programming / WTL

Form Designer

26 Jul 2021CPOL24 min read 349.7K   82.5K   230  
Component for adding scriptable forms capabilities to an application.
// EditableForm.h: interface for the CEditableForm class.
//
// Author : David Shepherd
//			Copyright (c) 2002, DaeDoe-Software
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_EDITABLEFORM_H__BB43CD32_1F17_11D6_B6A6_EAD35813C044__INCLUDED_)
#define AFX_EDITABLEFORM_H__BB43CD32_1F17_11D6_B6A6_EAD35813C044__INCLUDED_

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

/////////////////////////////////////////////////////////////////////////////
// CEditableForm
class CEditableForm : public CWindowImpl<CEditableForm>
{
private:
	// form width and height
	long m_Width;
	long m_Height;
	// background color
	OLE_COLOR m_BackColor;
	// foreground color
	OLE_COLOR m_ForeColor;
	// grid width and height
	long m_GridWidth;
	long m_GridHeight;
	// this will be set TRUE if the grid is visible
	BOOL m_ShowGrid;
public:
	CEditableForm();
	virtual ~CEditableForm();

	// sets the form dimensions
	void SetDimensions(long Width,long Height);
	// returns the form dimensions
	void GetDimensions(long &Width,long &Height) const;
	// sets the form colors
	void SetColors(OLE_COLOR BackColor,OLE_COLOR ForeColor);
	// returns the form colors
	void GetColors(OLE_COLOR &BackColor,OLE_COLOR &ForeColor) const;
	// sets the grid width and height
	void SetGrid(long Width,long Height);
	// returns the grid width and height
	void GetGrid(long &Width,long &Height) const;
	// sets the grid visibility
	void ShowGrid(BOOL Show=TRUE);
	// returns the grid visibility
	BOOL IsGridVisible() const;

BEGIN_MSG_MAP(CEditableForm)
MESSAGE_HANDLER(WM_PAINT, OnPaint)
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd)
END_MSG_MAP()

// message handlers
	LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnEraseBkgnd(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
};

#endif // !defined(AFX_EDITABLEFORM_H__BB43CD32_1F17_11D6_B6A6_EAD35813C044__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 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