本文主要是介绍在文本框中显示0-100,10行10列,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
View.cpp:
view.cpp:
void CMy1View::OnDraw(CDC* pDC)
{
CMy1Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
/*CRect rect;
this->GetWindowRect(&rect);
int x = rect.Width() / 2;
int y = rect.Height() / 2;
str.Format("计数%d",pDoc->num);
pDC->TextOut(x,y,str); */
//My001 str("寒冰",100);
//str.Display(pDC,20,20);
CWinApp *pW=::AfxGetApp();
CMy09App *pM=(CMy09App *)pW;
pDC->TextOut(10,10,pM->str);
int nCount=1,x=10,y=10,temp=10;
CString str;
for(;nCount<101;++nCount)
{
str.Format ("%d",nCount);
pDC->TextOut(x,y,str);
x+=30;
if(nCount==temp)
{
y+=30;
temp+=10;
x=10;
}
}
// TODO: add draw code for native data here
}
//还需在view.h里定义变量num
这篇关于在文本框中显示0-100,10行10列的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!