在vc ++中的CEdit控件中自动换行 [英] Word wrap in CEdit control in vc++
本文介绍了在vc ++中的CEdit控件中自动换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在MFC中的CEdit Control中将分号设置为自动换行中的分隔符,而不是默认分隔符作为空格。任何帮助,将不胜感激。在此先感谢。
我写了下面这段代码,但它不起作用。
I want to set semicolon as a delimiter in word wrap in CEdit Control in MFC instead of the default delimiter as space. Any help would be appreciated. Thanks in advance.
I wrote the following piece of code but it isn''t working.
BEGIN_MESSAGE_MAP(CMailListDlg, CDialog)
ON_MESSAGE(EM_SETWORDBREAKPROC,&CMailListDlg::EditWordBreakProc)
END_MESSAGE_MAP()
int CALLBACK CMailListDlg::EditWordBreakProc(LPTSTR lpszEditText, int ichCurrent, int cchEditText, int code)
{
char FAR *lpCurrentChar;
int nIndex;
int nLastAction;
switch (code)
{
case WB_ISDELIMITER:
// Windows sends this code so that the wordbreak function can
// check to see if the current character is the delimiter.
// If so, return TRUE. This will cause a line break at the ~
// character.
if ( lpszEditText[ichCurrent] == ';' )
return TRUE;
else
return FALSE;
break;
}
}
推荐答案
引用:
不工作
有点模糊。您应该使用调试器来验证究竟发生了什么(例如,检查您的回调是否被调用)。
作为附注
Is a bit vague. You should use the debugger for verifying what exactly happens (for instance, for checking if your callback is called).
As a side note
Quote:
if(lpszEditText [ichCurrent] =='';' ')
if ( lpszEditText[ichCurrent] == '';'' )
应该是
should be
if ( lpszEditText[ichCurrent] == _T(';') )
这篇关于在vc ++中的CEdit控件中自动换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文