积极答复者
VC++已实现横向输出,为什么一拉滚动条就变成竖向的了?

问题
-
void C路桥工程View::OnFileOpen()
{
// TODO: 在此添加命令处理程序代码
if (!sum1.empty())
{
sum1.clear();
}CFileDialog fileDlg(TRUE);
CString title1;
title1 = "打开文件";
CString filter1;
filter1 = "Text Files(*.txt)";
fileDlg.m_ofn.lpstrTitle = title1;
fileDlg.m_ofn.lpstrFilter = filter1;
if (IDOK == fileDlg.DoModal())
{
CFile file(fileDlg.GetFileName(), CFile::modeRead);
char *pBuf;
CString duzi1;
DWORD dwFileLen;
int wzcd1;
dwFileLen = file.GetLength();
wzcd1 = file.GetLength();
pBuf = new char[dwFileLen + 1];
pBuf[dwFileLen] = 0;
file.Read(pBuf, dwFileLen);
file.Close();
MessageBox((CString)pBuf);duzi1 = pBuf;
int number1=duzi1.GetLength();
//char* array=new char(number1);
CString array1;
for(int i2=0;i2<number1;i2++)
{
array1 = duzi1.GetAt(i2);//输出的字符
sum1.push_back(array1);
}
CDC* pDC=GetDC();
TEXTMETRIC tm2;
pDC->GetTextMetrics(&tm2);
int i1=0;
int p1;
int f1;
int i3 = sum1.size();
int p2 = 1024 / tm2.tmMaxCharWidth;
int f2 = i3 / p2;
while (i1 < i3)
{
for (f1 = 0; f1 < f2; f1++)
{
for (p1 = 0; p1 <= p2; p1++)
{
pDC->TextOut(tm2.tmMaxCharWidth*p1, tm2.tmHeight*f1, sum1[i1]);//横向输出
i1++;
}
}
}
SetScrollSizes(MM_TEXT, CSize(1024, tm2.tmHeight*f1));
}}
答案
-
参考这篇blog:
MFC让文档/视图结构程序支持滚动条
http://blog.csdn.net/kevin_samuel/article/details/8288617
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- 已标记为答案 Shu 2017 2015年2月16日 11:01
全部回复
-
参考这篇blog:
MFC让文档/视图结构程序支持滚动条
http://blog.csdn.net/kevin_samuel/article/details/8288617
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- 已标记为答案 Shu 2017 2015年2月16日 11:01