【发布时间】:2019-04-30 17:46:00
【问题描述】:
在注意到界面更新缓慢后,我按照CEdit SetWindowText rediculously slow 上的建议将文本附加到 CEdit 控件。
然后我换了
void CMyPropertyPage::Log(const CString& sLog)
{
CString str;
m_cLogEdit.GetWindowText(str);
if (!str.IsEmpty())
str += _T("\r\n");
str += sLog;
m_cLogEdit.SetWindowText(str);
m_cLogEdit.LineScroll(m_cLogEdit.GetLineCount());
}
由
void CMyPropertyPage::Log(const CString& sLog)
{
m_cLogEdit.SetSel(-1,-1);
m_cLogEdit.ReplaceSel(sLog + L"\r\n");
//m_cLogEdit.LineScroll(m_cLogEdit.GetLineCount());
UpdateData(FALSE);
UpdateWindow();
}
现在,当我运行它时,我注意到奇怪的字体模糊,因为它在图像中日志文本框的前两行中可见。
是什么原因,我该如何解决?
【问题讨论】:
-
您显示的代码没有任何问题。看起来您的系统或对话框上没有启用 cleartype 字体,所有字体看起来都很模糊。由于某种原因,编辑控件未正确重绘。看起来第一行画了4次,第二行画了3次……最后一行画了一次,背景没有重画。显示对话框 *.rc 代码和其他信息以重现此效果。
标签: visual-c++ textbox mfc append cedit