void CMyEdit::OnKillFocus(CWnd* pNewWnd) { CEdit::OnKillFocus(pNewWnd); if (GetWindowTextLength() <= 0 && !m_strDefText.IsEmpty()) { m_bIsDefText = TRUE; m_cPwdChar = GetPasswordChar(); SetPasswordChar(0); SetWindowText(m_strDefText); } m_bFocus = FALSE; RedrawWindow(NULL,NULL,RDW_FRAME|RDW_INVALIDATE|RDW_ERASE|RDW_ERASENOW); }
void CSkinEdit::OnKillFocus(CWnd* pNewWnd) { __super::OnKillFocus(pNewWnd); if (GetWindowTextLength() <= 0 && !m_strDefText.IsEmpty()) { m_bIsDefText = TRUE; m_cPwdChar = GetPasswordChar(); SetPasswordChar(0); SetWindowText(m_strDefText); } m_bFocus = FALSE; //Invalidate(FALSE); OnNcPaint(); }
void CMyEdit::SetDefaultTextMode(BOOL bIsDefText) { if (bIsDefText == m_bIsDefText) return; m_bIsDefText = bIsDefText; if (m_bIsDefText) { m_cPwdChar = GetPasswordChar(); SetPasswordChar(0); SetWindowText(m_strDefText); } else { SetPasswordChar(m_cPwdChar); SetWindowText(_T("")); } }