在窗口输出1~100的数字
void CMYView::OnDraw(CDC* pDC)
{
CMYDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
int nCount=1,x=10,y=10,temp=10; //定义初值,初始坐标,临时变量
CString str;
for(;nCount<101;++nCount) //能输出1~100的循环
{
str.Format("%d",nCount); //将格式转换为整形
pDC->TextOut(x,y,str); //在窗口输出
x+=30; //行间隔
if(nCount==temp) //10个数一行
{
y+=30; //列间隔
temp+=10;
x=10;
}
}
// TODO: add draw code for native data here
}
/
// CMYView printing