CWnd::ModifyStyle Call this member function to modify a window's style. BOOL ModifyStyle( DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0 );
Parameters dwRemove Specifies window styles to be removed during style modification.dwAdd Specifies window styles to be added during style modification.nFlags Flags to be passed to SetWindowPos, or zero if SetWindowPos should not be called. The default is zero. See the Res section for a list of preset flags.Return Value Nonzero if style was successfully modified; otherwise, 0.Res Styles to be added or removed can be combined by using the bitwise OR (|) operator. See the topics Window Styles and CreateWindow in the Platform SDK for information about the available window styles.If nFlags is nonzero, ModifyStyle calls the Windows API function SetWindowPos and redraws the window by combining nFlags with the following four preset flags: SWP_NOSIZE Retains the current size.SWP_NOMOVE Retains the current position.SWP_NOZORDER Retains the current Z order.SWP_NOACTIVATE Does not activate the window.To modify a window's extended styles, see ModifyStyleEx.Note For some styles in certain controls (the ES_READONLY style in the edit control, for example), ModifyStyle may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available (EM_SETREADONLY in the example mentioned). Example Copy Code // This example adds the WS_CLIPCHILDREN style to the window. // No Styles are removed from the window.void CMyView::OnInitialUpdate() { CView::OnInitialUpdate(); ModifyStyle(0, WS_CLIPCHILDREN); }
你要的是这个:ES_PASSWORD Displays all characters as an asterisk (*) as they are typed into the edit control. An application can use the SetPasswordChar member function to change the character that is displayed.
void CTestDialogDlg::OnRadio1() { // TODO: Add your control notification handler code here m_bShowPassword = 0; // //m_password:编辑框控件 m_password.SetPasswordChar(0); //取消密码显示 //m_password.ModifyStyle(ES_PASSWORD,NULL); //这句好像不要也行 m_password.Invalidate(); //这句必需 }void CTestDialogDlg::OnRadio2() { // TODO: Add your control notification handler code here m_bShowPassword = 1; // //m_password:编辑框控件 m_password.SetPasswordChar('X'); //密码显示 //m_password.ModifyStyle(NULL,ES_PASSWORD); //这句好像不要也行 m_password.Invalidate(); //这句必需 }
BOOL ModifyStyle(
DWORD dwRemove,
DWORD dwAdd,
UINT nFlags = 0
);
Parameters
dwRemove
Specifies window styles to be removed during style modification.dwAdd
Specifies window styles to be added during style modification.nFlags
Flags to be passed to SetWindowPos, or zero if SetWindowPos should not be called. The default is zero. See the Res section for a list of preset flags.Return Value
Nonzero if style was successfully modified; otherwise, 0.Res
Styles to be added or removed can be combined by using the bitwise OR (|) operator. See the topics Window Styles and CreateWindow in the Platform SDK for information about the available window styles.If nFlags is nonzero, ModifyStyle calls the Windows API function SetWindowPos and redraws the window by combining nFlags with the following four preset flags: SWP_NOSIZE Retains the current size.SWP_NOMOVE Retains the current position.SWP_NOZORDER Retains the current Z order.SWP_NOACTIVATE Does not activate the window.To modify a window's extended styles, see ModifyStyleEx.Note
For some styles in certain controls (the ES_READONLY style in the edit control, for example), ModifyStyle may not properly change the style because the control may need to perform special internal processing. In these cases, a corresponding message to change the style will be available (EM_SETREADONLY in the example mentioned).
Example
Copy Code
// This example adds the WS_CLIPCHILDREN style to the window.
// No Styles are removed from the window.void CMyView::OnInitialUpdate()
{
CView::OnInitialUpdate();
ModifyStyle(0, WS_CLIPCHILDREN);
}
你要的是这个:ES_PASSWORD Displays all characters as an asterisk (*) as they are typed into the edit control. An application can use the SetPasswordChar member function to change the character that is displayed.
{
// TODO: Add your control notification handler code here
m_bShowPassword = 0; // //m_password:编辑框控件
m_password.SetPasswordChar(0); //取消密码显示
//m_password.ModifyStyle(ES_PASSWORD,NULL); //这句好像不要也行
m_password.Invalidate(); //这句必需
}void CTestDialogDlg::OnRadio2()
{
// TODO: Add your control notification handler code here
m_bShowPassword = 1; // //m_password:编辑框控件
m_password.SetPasswordChar('X'); //密码显示
//m_password.ModifyStyle(NULL,ES_PASSWORD); //这句好像不要也行
m_password.Invalidate(); //这句必需
}