Click here to Skip to main content
13,346,713 members (68,100 online)
Click here to Skip to main content

Stats

270.7K views
76.8K downloads
224 bookmarked
Posted 30 Dec 2005

Form Designer

, 1 Aug 2009
Component for adding scriptable forms capabilities to an application.
MFCDemo.exe
CSDemo
App.ico
Bmp
ABottom.bmp
About.bmp
ALeft.bmp
ARight.bmp
ATop.bmp
AX.bmp
BringFront.bmp
Button.bmp
Center.bmp
Check.bmp
Combo.bmp
Copy.bmp
Cut.bmp
Delete.bmp
Down.bmp
Edit.bmp
Frame.bmp
Grid.bmp
GridSettings.bmp
HCenter.bmp
HScroll.bmp
HSL.bmp
HSpace.bmp
HSS.bmp
Left.bmp
List.bmp
New.bmp
Open.bmp
Paste.bmp
Picture.bmp
Preview.bmp
Progress.bmp
Props.bmp
Radio.bmp
Rectangle.bmp
Redo.bmp
Right.bmp
Save.bmp
SelAll.bmp
SelNone.bmp
SendBack.bmp
SL.bmp
Slider.bmp
Spin.bmp
SS.bmp
Tab.bmp
Text.bmp
Undo.bmp
Up.bmp
Validate.bmp
VCenter.bmp
VScroll.bmp
VSL.bmp
VSpace.bmp
VSS.bmp
Wand.bmp
CSDemo.suo
DaeDoe.bmp
MFCDemo
MFCDemo.dsp
MFCDemo.odl
res
DaeDoe.bmp
MFCDemo.ico
MFCDemoDoc.ico
Toolbar1.bmp
Toolbar2.bmp
Toolbar3.bmp
Wand.bmp
VBDemo
Bmp
ABottom.bmp
About.bmp
ALeft.bmp
ARight.bmp
ATop.bmp
AX.bmp
BringFront.bmp
Button.bmp
Center.bmp
Check.bmp
Combo.bmp
Copy.bmp
Cut.bmp
Delete.bmp
Down.bmp
Edit.bmp
Frame.bmp
Grid.bmp
GridSettings.bmp
HCenter.bmp
HScroll.bmp
HSL.bmp
HSpace.bmp
HSS.bmp
Left.bmp
List.bmp
New.bmp
Open.bmp
Paste.bmp
Picture.bmp
Preview.bmp
Progress.bmp
Props.bmp
Radio.bmp
Rectangle.bmp
Redo.bmp
Right.bmp
Save.bmp
SelAll.bmp
SelNone.bmp
SendBack.bmp
SL.bmp
Slider.bmp
Spin.bmp
SS.bmp
Tab.bmp
Text.bmp
Undo.bmp
Up.bmp
Validate.bmp
VCenter.bmp
VScroll.bmp
VSL.bmp
VSpace.bmp
VSS.bmp
Wand.bmp
Class1.cls
Class2.cls
DaeDoe.bmp
Form1.frm
Form1.frx
Form2.frm
Form2.frx
Form3.frm
Form4.frm
Form5.frm
Form5.frx
Form6.frm
Form6.frx
Form7.frm
Form7.frx
Form8.frm
Form8.frx
Module1.bas
VBDemo.vbp
DDForms.chm
DDForms
Archive
FormEditorItems.rgs
vssver.scc
Constants.scr
DaeDoe.bmp
DDForms.def
DDForms.vcproj.vspscc
EventSinkPassThrough.rgs
FormEditor.bmp
FormEditor.rgs
FormEditorItemCollection.rgs
FormEditorItemDetails.rgs
FormViewer.bmp
FormViewer.rgs
FormViewerItemCollection.rgs
FormViewerItemDetails.rgs
mssccprj.scc
PropPageExtended.rgs
PropPageFormEditor.rgs
PropPageFormViewer.rgs
PropPageSimpleScriptEditor.rgs
SimpleScriptEditor.bmp
SimpleScriptEditor.rgs
vssver.scc
DDFormsTools
CodeMaxDriver
CodeMaxDriver.rgs
CodeMaxDriver.vcproj.vspscc
CodeMaxDriverps.def
CodeMaxDriverPS.vcproj.vspscc
mssccprj.scc
vssver.scc
CodeSenseDriver
CodeSenseDriver.rgs
CodeSenseDriver.vcproj.vspscc
CodeSenseDriverps.def
CodeSenseDriverPS.vcproj.vspscc
mssccprj.scc
vssver.scc
DDPropPageAll
DDPropPageAll.def
DDPropPageAll.vcproj.vspscc
mssccprj.scc
PropPageAll.rgs
vssver.scc
DDUnlock
DDUnlock.vcproj.vspscc
mssccprj.scc
vssver.scc
DDControlPack
DDButton.bmp
DDCheckBox.bmp
DDComboBox.bmp
DDControlPack.rgs
DDControlPack.vcproj.vspscc
DDHorzScrollBar.bmp
DDLabel.bmp
DDListBox.bmp
DDPicture.bmp
DDRadioButton.bmp
DDTextBox.bmp
DDVertScrollBar.bmp
mssccprj.scc
vssver.scc
Redistributables
Ansi
CodeMaxDriver.dll
CodeSenseDriver.dll
DDControlPack.dll
DDForms.dll
DDPropPageAll.dll
Unicode
CodeMaxDriver.dll
CodeSenseDriver.dll
DDControlPack.dll
DDForms.dll
DDPropPageAll.dll
// DDLabel.h : Declaration of the CDDLabel
//
// Author : David Shepherd
//			Copyright (c) 2003, DaeDoe-Software
//
/////////////////////////////////////////////////////////////////////////////

#pragma once

#include "resource.h"       // main symbols
#include <atlctl.h>

/////////////////////////////////////////////////////////////////////////////
// IDDLabel
[
	object,
	uuid("E3CE4FEA-A6FC-4D42-8EED-4AD366165B83"),
	dual,
	helpstring("IDDLabel Interface"),
	pointer_default(unique)
]
__interface IDDLabel : public IDispatch
{
	////////////////////////////////////////
	// background color
	[propget, requestedit, bindable,
		id(DISPID_BACKCOLOR),
		helpstring("")]
	HRESULT BackColor([out, retval] OLE_COLOR* pVal);
	[propput, requestedit, bindable,
		id(DISPID_BACKCOLOR),
		helpstring("")]
	HRESULT BackColor([in] OLE_COLOR newVal);
	////////////////////////////////////////
	// foreground color
	[propget, requestedit, bindable,
		id(DISPID_FORECOLOR),
		helpstring("")]
	HRESULT ForeColor([out, retval] OLE_COLOR* pVal);
	[propput, requestedit, bindable,
		id(DISPID_FORECOLOR),
		helpstring("")]
	HRESULT ForeColor([in] OLE_COLOR newVal);
	////////////////////////////////////////
	// font
	[propget, requestedit, bindable,
		id(DISPID_FONT),
		helpstring("")]
	HRESULT Font([out, retval] IFontDisp** pVal);
	[propput, requestedit, bindable,
		id(DISPID_FONT),
		helpstring("")]
	HRESULT Font([in] IFontDisp* newVal);
	[propputref, requestedit, bindable,
		id(DISPID_FONT),
		helpstring("")]
	HRESULT Font([in] IFontDisp* newVal);
	////////////////////////////////////////
	// text
	[propget, requestedit, bindable,
		id(DISPID_TEXT),
		helpstring("")]
	HRESULT Text([out, retval] BSTR* pVal);
	[propput, requestedit, bindable,
		id(DISPID_TEXT),
		helpstring("")]
	HRESULT Text([in] BSTR newVal);
	////////////////////////////////////////
	// text align
	[propget, requestedit, bindable,
		id(DISPID_TEXTALIGN),
		helpstring("")]
	HRESULT TextAlign([out, retval] ddcpTextAlign* pVal);
	[propput, requestedit, bindable,
		id(DISPID_TEXTALIGN),
		helpstring("")]
	HRESULT TextAlign([in] ddcpTextAlign newVal);
	////////////////////////////////////////
	// center vertically
	[propget, requestedit, bindable,
		id(DISPID_CENTERVERTICALLY),
		helpstring("")]
	HRESULT CenterVertically([out, retval] VARIANT_BOOL* pVal);
	[propput, requestedit, bindable,
		id(DISPID_CENTERVERTICALLY),
		helpstring("")]
	HRESULT CenterVertically([in] VARIANT_BOOL newVal);
	////////////////////////////////////////
	// border style
	[propget, requestedit, bindable,
		id(DISPID_BORDERSTYLE),
		helpstring("")]
	HRESULT BorderStyle([out, retval] ddcpBorderStyle* pVal);
	[propput, requestedit, bindable,
		id(DISPID_BORDERSTYLE),
		helpstring("")]
	HRESULT BorderStyle([in] ddcpBorderStyle newVal);
	////////////////////////////////////////
	// default property
	[propget, nonbrowsable,
		id(DISPID_VALUE),
		helpstring("")]
	HRESULT _Default([out, retval] BSTR* pVal);
	[propput, nonbrowsable,
		id(DISPID_VALUE),
		helpstring("")]
	HRESULT _Default([in] BSTR newVal);
};

/////////////////////////////////////////////////////////////////////////////
// _IDDLabelEvents
[
	uuid("EB86147F-FFEC-44AB-BADA-F1F17FBA0A4A"),
	dispinterface,
	helpstring("_IDDLabelEvents Interface")
]
__interface _IDDLabelEvents
{
};

/////////////////////////////////////////////////////////////////////////////
// CDDLabel
[
	coclass,
	threading("apartment"),
	vi_progid("DDControlPack.DDLabel"),
	progid("DDControlPack.DDLabel.1"),
	version(1.0),
	uuid("EC117994-19AF-4038-99A2-485B6CDC0126"),
	helpstring("DDLabel Class"),
	event_source("com"),
	support_error_info(IDDLabel),
	registration_script("control.rgs")
]
class ATL_NO_VTABLE CDDLabel :
	public IDispatchImpl<IDDLabel>,
	public IPersistStreamInitImpl<CDDLabel>,
	public IOleControlImpl<CDDLabel>,
	public IOleObjectImpl<CDDLabel>,
	public IOleInPlaceActiveObjectImpl<CDDLabel>,
	public IViewObjectExImpl<CDDLabel>,
	public IOleInPlaceObjectWindowlessImpl<CDDLabel>,
	public IPersistStorageImpl<CDDLabel>,
	public ISpecifyPropertyPagesImpl<CDDLabel>,
	public IQuickActivateImpl<CDDLabel>,
	public IDataObjectImpl<CDDLabel>,
	public CComControl<CDDLabel>
{
private:
	__event __interface _IDDLabelEvents;

/////////////////////////////////////////////////////////////////////////////
// properties
	LONG					m_Reserved0;			// reserved
	LONG					m_Reserved1;			// reserved
	OLE_COLOR				m_BackColor;			// background color
	OLE_COLOR				m_ForeColor;			// foreground color
	CComPtr<IFontDisp>		m_spFontDisp;			// font
	CComBSTR				m_Text;					// text
	ddcpTextAlign			m_TextAlign;			// text align
	VARIANT_BOOL			m_CenterVertically;		// center vertically
	ddcpBorderStyle			m_BorderStyle;			// border style

/////////////////////////////////////////////////////////////////////////////
// property change validators
	HRESULT OnTextAlignChanging(ddcpTextAlign newVal);
	HRESULT OnBorderStyleChanging(ddcpBorderStyle newVal);

/////////////////////////////////////////////////////////////////////////////
// property change handlers

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

	// draws the border
	void DrawBorder(CDCHandle hDC,CRect Rect);
	// draws the text
	void DrawText(CDCHandle hDC,CRect Rect);

public:
	CDDLabel();

DECLARE_PROTECT_FINAL_CONSTRUCT()

	HRESULT FinalConstruct();
	void FinalRelease();

static const TCHAR* GetObjectFriendlyName();

DECLARE_OLEMISC_STATUS(
	OLEMISC_RECOMPOSEONRESIZE |
	OLEMISC_CANTLINKINSIDE |
	OLEMISC_INSIDEOUT |
	OLEMISC_ACTIVATEWHENVISIBLE |
	OLEMISC_ACTSLIKELABEL |
	OLEMISC_SETCLIENTSITEFIRST)

BEGIN_PROP_MAP(CDDLabel)
	PROP_DATA_ENTRY("_reserved0", m_Reserved0, VT_I4)
	PROP_DATA_ENTRY("_reserved1", m_Reserved1, VT_I4)
	PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
	PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
	PROP_ENTRY("BackColor", DISPID_BACKCOLOR, CLSID_NULL)
	PROP_ENTRY("ForeColor", DISPID_FORECOLOR, CLSID_NULL)
	PROP_ENTRY("Font", DISPID_FONT, CLSID_NULL)
	PROP_ENTRY("Text", DISPID_TEXT, CLSID_NULL)
	PROP_ENTRY("TextAlign", DISPID_TEXTALIGN, CLSID_NULL)
	PROP_ENTRY("CenterVertically", DISPID_CENTERVERTICALLY, CLSID_NULL)
	PROP_ENTRY("BorderStyle", DISPID_BORDERSTYLE, CLSID_NULL)
	// Example entries
	// PROP_ENTRY("Property Description", dispid, clsid)
	// PROP_PAGE(CLSID_StockColorPage)
END_PROP_MAP()

BEGIN_MSG_MAP(CDDLabel)
	MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd)
	CHAIN_MSG_MAP(CComControl<CDDLabel>)
	DEFAULT_REFLECTION_HANDLER()
END_MSG_MAP()
// Handler prototypes:
//  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
//  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
//  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);

// base class overrides
	HRESULT OnDraw(ATL_DRAWINFO& di);

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

// IOleObject
	STDMETHOD(SetClientSite)(IOleClientSite *pClientSite);

// IViewObjectEx
	DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)

// IDDLabel
	IMPLEMENT_CUSTOM_COLOR_PROPERTY(BackColor,m_BackColor,DISPID_BACKCOLOR);
	IMPLEMENT_CUSTOM_COLOR_PROPERTY(ForeColor,m_ForeColor,DISPID_FORECOLOR);
	IMPLEMENT_CUSTOM_FONT_PROPERTY(Font,m_spFontDisp,DISPID_FONT);
	IMPLEMENT_CUSTOM_TEXT_PROPERTY(Text,m_Text,DISPID_TEXT);
	IMPLEMENT_CUSTOM_PROPERTY(ddcpTextAlign,TextAlign,m_TextAlign,DISPID_TEXTALIGN);
	IMPLEMENT_CUSTOM_BOOL_PROPERTY(CenterVertically,m_CenterVertically,DISPID_CENTERVERTICALLY);
	IMPLEMENT_CUSTOM_PROPERTY(ddcpBorderStyle,BorderStyle,m_BorderStyle,DISPID_BORDERSTYLE);
	STDMETHOD(get__Default)(BSTR* pVal);
	STDMETHOD(put__Default)(BSTR newVal);
};

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)

Share

About the Author

DaveShep
Web Developer
United Kingdom United Kingdom
No Biography provided

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.180111.1 | Last Updated 1 Aug 2009
Article Copyright 2005 by DaveShep
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid