C++调试问题
#include "stdafx.h"
#include "Fivechess_44.h"
#include "Fivechess_44Doc.h"
#include "Fivechess_44View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFivechess_44View
IMPLEMENT_DYNCREATE(CFivechess_44View, CView)
BEGIN_MESSAGE_MAP(CFivechess_44View, CView)
//{{AFX_MSG_MAP(CFivechess_44View)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CFivechess_44View construction/destruction
CFivechess_44View::CFivechess_44View()
{
// TODO: add construction code here
}
CFivechess_44View::~CFivechess_44View()
{
}
BOOL CFivechess_44View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CFivechess_44View drawing
void CFivechess_44View::OnDraw(CDC* pDC)
{
CFivechess_44Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
void CFivechess_44View::Checkerboard(CDC*pDC)
{
for(int i=0;i<20;i++) //连续画20条竖线
{
pDC->MoveTo(i*50,0); //画笔移动到(i*50,0)点
pDC->LineTo(i*50,1000); // 画笔从(i*50,0)点到(i*50,1000)点
}
for(i=0;i<20;i++) //连续画20条横线
{
pDC->MoveTo(0,i*50);
pDC->LineTo(1000,i*50);
}
}
void CFivechess_44View::OnDraw(CDC* pDC)
{
CFivechess_44Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
Checkerboard(pDC); //调用自定义的画键盘函数
}
/////////////////////////////////////////////////////////////////////////////
// CFivechess_44View printing
BOOL CFivechess_44View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CFivechess_44View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CFivechess_44View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CFivechess_44View diagnostics
#ifdef _DEBUG
void CFivechess_44View::AssertValid() const
{
CView::AssertValid();
}
void CFivechess_44View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CFivechess_44Doc* CFivechess_44View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CFivechess_44Doc)));
return (CFivechess_44Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CFivechess_44View message handlers
调试中出现的问题:D:\C++课程设计\fivechess\Fivechess_44\Fivechess_44View.cpp(76) : error C2084: function 'void __thiscall CFivechess_44View::OnDraw(class CDC *)' already has a body
跪求大佬指教