Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Add/remove border on edit control in dialog box in MFC?

1,020 views
Skip to first unread message

kenshine

unread,
Jun 30, 1999, 3:00:00 AM6/30/99
to
I have an edit control in a dialog box for which I at some times want a
border and at other times I do not.

I have tried using ModifyStyleEx() (and ModifyStyle()) to change the style
but they seem to have no effect. By checking and unchecking the Border
check box in the resource editor and then using GetStyleEx, I can tell the
the border corresponds to extended window style WS_EX_CLIENTEDGE =
0x00000200. I can reset it with ModifyStyleEx and use GetStyleEx() to tell
that it was changed, but the edit control displayed never changes it's
border. I have tried both ModifyStyleEx(WS_EX_CLIENTEDGE,0) and
ModifyStyleEx(WS_EX_CLIENTEDGE,SWP_NOSIZE) and also invalidating the window.

How the add and remove the border???????

Thanks for any help.
Ken

BOOL CSystemConfig::OnInitDialog()
{
CPropertyPage::OnInitDialog();

BOOL b = false;
m_pEdit = (CEdit*)GetDlgItem(IDC_EDIT);

//remove border
b = m_pEdit->ModifyStyle(WS_BORDER,0);
b = m_pEdit->ModifyStyleEx(WS_EX_CLIENTEDGE,0);


DWORD style = m_pEdit->GetStyle( );
DWORD Exstyle = m_pEdit->GetExStyle( );
}


Scott McPhillips

unread,
Jun 30, 1999, 3:00:00 AM6/30/99
to

Many controls do not reinitialize when the style bits are changed. You can make one edit in each style and make only the one you want visible.

0 new messages