omkumarSabari
March 31st, 1999, 05:10 AM
I have created an activeX control subclassing an edit control. I have a property page where i will ask for the alignment of the text such as Left, Centered or Right. I dont know how to change the style of the edit control. Also I need Auto HScroll and Auto VScroll properties in the same edit control. If anybody knows it please do reply at the earnest possibility. Because this is delaying the release of our product. Thank you in advance.
Dieter Gollwitzer
March 31st, 1999, 07:39 AM
The code bellow is a part from a COleControl-derived class which implements
a subclassed editcontrol. This control has a property with the name
"BorderStyle". The associated member variable is m_border. I hope this
code example helps you.
Dieter
The member m_border has the following values:
enum {
Border_None = 0,
Border_Flat = 1,
Border_ClientEdge = 2,
};
BOOL CRegexeditCtrl::PreCreateWindow(CREATESTRUCT& cs)
{
cs.lpszClass = _T("EDIT");
cs.style |= ES_AUTOHSCROLL;
cs.style &= ~WS_BORDER;
cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
if (m_border == Border_Flat)
cs.style |= WS_BORDER;
if (m_border == Border_ClientEdge)
cs.dwExStyle |= WS_EX_CLIENTEDGE;
return COleControl::PreCreateWindow(cs);
}
CRegexeditCtrl::CRegexeditCtrl()
{
InitializeIIDs(&IID_DRegexedit, &IID_DRegexeditEvents);
m_border = Border_ClientEdge;
...
}
void CRegexeditCtrl::DoPropExchange(CPropExchange* pPX)
{
ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor));
COleControl::DoPropExchange(pPX);
// TODO: Call PX_ functions for each persistent custom property.
PX_Long(pPX,_T("Border"),m_border,Border_ClientEdge);
...
}
void CRegexeditCtrl::OnResetState()
{
COleControl::OnResetState(); // Resets defaults found in DoPropExchange
// TODO: Reset any other control state here.
m_border = Border_ClientEdge;
}