使用CEdit::SetLimitText()函数来完成此功能。

Call this member function to set the text limit for this CEdit object.

 

void SetLimitText(

   UINT nMax

);

 

nMax: The new text limit, in characters.

比如限制ID为IDC_EDIT_CODE的编辑框控件,最多只能输入30个字符。

((CEdit *)GetDlgItem(IDC_EDIT_CODE))->SetLimitText(30);

相关文章:

  • 2021-09-09
  • 2021-10-22
  • 2021-11-05
  • 2021-12-06
  • 2022-12-23
  • 2021-09-17
  • 2022-02-03
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-12
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案