从richeditctrl中按“\n”换行显示
来源:百度文库 编辑:神马文学网 时间:2024/06/04 01:42:56
方法一:字串超长时不会换行
CString strText=m_txt+"\n";
int iPos = strText.Find(‘\n‘);
int iLen=strlen(strText);
int iAbsPos =0;
CString str;
while(iPos > -1){
str = strText.Mid(0,iPos+1);
nPosY=3*m_cyPrinter*(12+j);
j=j+1;
pDC->TextOut(nPosX,nPosY,str);
}
strText = strText.Mid(iPos + 1);
iPos = strText.Find(‘\n‘);
}
方法二:最有效的
int nn=m_test.GetLineCount();
int itPos;
// int j=0;
for (int i=0;i{
nPosY=m_cyPrinter*(12+i);
itPos = m_test.LineLength(i);
m_test.GetLine(i,str.GetBuffer(itPos));
str.ReleaseBuffer();
pDC->TextOut(nPosX,nPosY,str);
}
方法三:可以得到的矩形区域
FORMATRANGE fr;
// Get the page width and height from the printer.
long lPageWidth =pDC->GetDeviceCaps(PHYSICALWIDTH);// ::MulDiv(pDC->GetDeviceCaps(PHYSICALWIDTH),
1440, pDC->GetDeviceCaps(LOGPIXELSX));
long lPageHeight =pDC->GetDeviceCaps(PHYSICALHEIGHT); //::MulDiv(pDC->GetDeviceCaps(PHYSICALHEIGHT),
1440, pDC->GetDeviceCaps(LOGPIXELSY));
CRect rcPage(nPosX ,nPosY,lPageWidth,lPageHeight);//lPageWidth, lPageHeight);
pDC->SetMapMode(MM_ANISOTROPIC);
// Format the text and render it to the printer.
fr.hdc = pDC->m_hDC;
fr.hdcTarget = pDC->m_hDC;
fr.rc = rcPage;
fr.rcPage = rcPage;
fr.chrg.cpMin = 0;
fr.chrg.cpMax = -1;
m_test.FormatRange(&fr, TRUE);
m_test.DisplayBand(&rcPage);
CString strText=m_txt+"\n";
int iPos = strText.Find(‘\n‘);
int iLen=strlen(strText);
int iAbsPos =0;
CString str;
while(iPos > -1){
str = strText.Mid(0,iPos+1);
nPosY=3*m_cyPrinter*(12+j);
j=j+1;
pDC->TextOut(nPosX,nPosY,str);
}
strText = strText.Mid(iPos + 1);
iPos = strText.Find(‘\n‘);
}
方法二:最有效的
int nn=m_test.GetLineCount();
int itPos;
// int j=0;
for (int i=0;i
nPosY=m_cyPrinter*(12+i);
itPos = m_test.LineLength(i);
m_test.GetLine(i,str.GetBuffer(itPos));
str.ReleaseBuffer();
pDC->TextOut(nPosX,nPosY,str);
}
方法三:可以得到的矩形区域
FORMATRANGE fr;
// Get the page width and height from the printer.
long lPageWidth =pDC->GetDeviceCaps(PHYSICALWIDTH);// ::MulDiv(pDC->GetDeviceCaps(PHYSICALWIDTH),
1440, pDC->GetDeviceCaps(LOGPIXELSX));
long lPageHeight =pDC->GetDeviceCaps(PHYSICALHEIGHT); //::MulDiv(pDC->GetDeviceCaps(PHYSICALHEIGHT),
1440, pDC->GetDeviceCaps(LOGPIXELSY));
CRect rcPage(nPosX ,nPosY,lPageWidth,lPageHeight);//lPageWidth, lPageHeight);
pDC->SetMapMode(MM_ANISOTROPIC);
// Format the text and render it to the printer.
fr.hdc = pDC->m_hDC;
fr.hdcTarget = pDC->m_hDC;
fr.rc = rcPage;
fr.rcPage = rcPage;
fr.chrg.cpMin = 0;
fr.chrg.cpMax = -1;
m_test.FormatRange(&fr, TRUE);
m_test.DisplayBand(&rcPage);
从richeditctrl中按“\n”换行显示
回车换行(\r\n)整理 -
VC中字符串换行
JAVA读取文件时,怎么显示里面的换行效果
从数据库中读出图片并显示的示例代码
从民意的测试中显示--右派已经丧失民心
从数据库中随机抽N条记录
怎样让记事本的状态栏与自动换行同时显示_
从文件中读n个取数字到RArray中
在word中删除网页内容里的下箭头换行符
在word中删除网页内容里的下箭头换行符
软件开发问题解答资料----在VC中,编码过长如何换行,比如字符串
软件开发问题解答资料----在VC中,编码过长如何换行,比如字符串
在word中删除网页内容里的下箭头换行符111
PHP中关于正则表达式匹配任意字符(包括换行符)的写法
建设学习型政党 从读经典原著中提升理论素养 n
从影响中国三十年的五大趋势中寻找优质成长股n
豆浆N中做法
css实现页面文字不换行、自动换行、强制换行
SPSS13中显示中文结果
css之自动换行
批量删除换行
XML换行转义符
:在uC/GUI中实现汉字显示