RichEdit 中tab键的输入 (急!!!!!!!!)
请教:
我在Richedit中按下tab键时会全选控件中的文本,而不是输入'\t',
应该如何设置
多多帮忙!
问题点数:50、回复次数:3Top
1 楼PhilLee(菲尔)回复于 2005-05-19 13:48:30 得分 0
补充:
按Ctrl+tab可以实现Top
2 楼figer()回复于 2005-05-19 14:14:12 得分 30
if(nChar == 0x09)
{
CString str="\t";
CHARRANGE crPos;
GetSel(crPos);
if (crPos.cpMin != crPos.cpMax)
{
SetSel(crPos.cpMin, crPos.cpMax);
}
else
{
SetSel(crPos.cpMax, crPos.cpMax);
}
ReplaceSel(str);
return;
}
代码加入到onkeydown()消息中.Top
3 楼vcmute(BCare4 H1Rest Good9!)回复于 2005-05-19 14:19:02 得分 20
重载PreTranslateMessage(MSG* pMsg)
BOOL CTestDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message==WM_KEYDOWN && pMsg->wParam == VK_TAB)
{
if(m_rich.GetSafeHwnd()==GetFocus()->GetSafeHwnd())
{
m_rich.ReplaceSel("\t");
return TRUE;
}
}
return CDialog::PreTranslateMessage(pMsg);
}Top




