(4)信息的分条显示
void CTipDlg::OnOK()
{
GetNextTipString(m_strTip);
makeMultiLine(m_strTip);
UpdateData(FALSE);
}
void CTipDlg::makeMultiLine(CString& m_strTip)
{
char eol[3] = {13, 10};
CString multiLineStr, srcStr, extStr, tmpStr;
multiLineStr = _T("");
srcStr = m_strTip;
int idx;
while(!srcStr.IsEmpty()) {
idx = srcStr.Find("\\n");//以\n问判断标记
if(idx != -1) {
extStr = srcStr.Left(idx);
tmpStr.Format("%s%s", extStr, eol);
multiLineStr += tmpStr;
srcStr = srcStr.Mid(idx + 2);
} else {
multiLineStr += srcStr;
break;
}
}
idx = multiLineStr.ReverseFind('\n'); // end of the ONE tip
if(idx != -1) {
multiLineStr = multiLineStr.Left(idx);
tmpStr.Format("%s%s", multiLineStr, eol);
multiLineStr = tmpStr;
}
m_strTip = multiLineStr;
}
void CTipDlg::GetNextTipString(CString &strNext)
{
|