东软实训之项目1到100十行十列数排列
// ShixunView.cpp : implementation of the CShixunView class
//
#include "stdafx.h"
#include "Shixun.h"
#include "ShixunDoc.h"
#include "ShixunView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/
// CShixunView
IMPLEMENT_DYNCREATE(CShixunView, CView)
BEGIN_MESSAGE_MAP(CShixunView, CView)
//{{AFX_MSG_MAP(CShixunView)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/
// CShixunView construction/destruction
CShixunView::CShixunView()
{
// TODO: add construction code here
}
CShixunView::~CShixunView()
{
}
BOOL CShixunView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/
// CShixunView drawing
void CShixunView::OnDraw(CDC* pDC)
{
CShixunDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
int i=1;//计数,从1开始;
int x=10,y=10,temp=10;//x,y坐标
CString str;
for(;i<101;++i)
{
str.Format("%d",i);
pDC->TextOut(x,y,str);
x+=30;
if(i==temp)
{
y+=30;
temp+=10;
x=10;//从下一排开始
}
}
// TODO: add draw code for native data here
}
/
// CShixunView printing
BOOL CShixunView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CShixunView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CShixunView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/
// CShixunView diagnostics
#ifdef _DEBUG
void CShixunView::AssertValid() const
{
CView::AssertValid();
}
void CShixunView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CShixunDoc* CShixunView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CShixunDoc)));
return (CShixunDoc*)m_pDocument;
}
#endif //_DEBUG
/
// CShixunView message handlers