16,470
社区成员
发帖
与我相关
我的任务
分享
void CTestDlg::OnEnUpdateEdit1()
{
const int m_maxTxtLen = 5;
CEdit *pEdit = &m_EditCtrl;
CString strVal;
pEdit->GetWindowText(strVal);
if(strVal.GetLength() > m_maxTxtLen)
{
pEdit->SetSel(0, -1);
pEdit->ReplaceSel(strVal.Right(m_maxTxtLen));
}
}