Duilib下编辑框限定字符字数问题

来源:互联网 发布:手机发布淘宝宝贝 编辑:程序博客网 时间:2024/04/30 00:57

在Duilib下限定字符个数,可以通过配置文件中加入maxchar来设置或者在代码里调用SetMaxChar(UINT uMax)函数来进行限定,但是当你调试的时候,发现自己设定的与自己输入的不一致,按常理说maxchar="10",那就是5个中文10个英文,但是在Edit里面却能输入10个中文10个英文,为什么会出现这样的现象呢?原因就是我们没有添加一段代码。

#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif

原创粉丝点击