首先xml文件中设置edit的maxchar参数,默认255好像。
<edit maxchar="10" />
然后在notify函数中加入以下代码
if (msg.sType == _T("textchanged")) {
if (static_cast<CEditUI*>(msg.pSender)->GetMaxChar() == msg.pSender->GetText().GetLength()) {
PostMessage(WM_KEYDOWN, VK_TAB);
}
}
限制Edit控件输入长度
本文介绍如何在XML文件中设置Edit控件的maxchar参数来限制输入长度,并通过notify函数监测文本变化,当达到最大长度时自动发送Tab键消息。
542

被折叠的 条评论
为什么被折叠?



