解决方案 »

  1.   

    CString m_strEdit;
    CString str;
    if (nChar >= _T('0') && nChar <= _T('9'))
    {
       str.Format(_T("%c",nChar );
    }
      

  2.   

    晕,没写完就发了!CString m_strEdit;//绑定的控件变量
    CString str;
    if (nChar >= _T('0') && nChar <= _T('9'))
    {
       int nLen = m_strEdit.GetLength()/3;
       if(m_strEdit.GetLength()>0 && (m_strEdit.GetLength()-nLen)%2 == 0)
          m_strEdit += _T("-");
       str.Format(_T("%c",nChar );
       m_strEdit += str;
       UpdateData(FALSE);
    }
    CEdit::OnChar(nChar, nRepCnt, nFlags);
      

  3.   

    刚给你写了 一个方案可惜断电了 
    无奈
    BOOL isOK(CString&s)
    {
        int n=0;
        for(int i=0;i<s.GetLength();i++)
        {
            if(s[i]<0x80)
                n++;
            else
                n+=2;
        }
        if(n == 19 && 其他条件 格式等等)
            return TRUE;
        else
             return FALSE;}控件 Onchange 事件添加成员函数
    判断 m_strEidt 合法就UpdateData(TRUE);
    if(IsOK(m_strEidt))
    {
         m_strEidt +=N_T(" +"));//自动田添加
          UpdateData(false)
    }