📄 mygameview1.cpp
字号:
// MyGameView1.cpp : implementation file
//
#include "stdafx.h"
#include "MyGame.h"
#include "MyGameDoc.h"
#include "MyGameView1.h"
#include "GobangDrawer.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyGameView1
IMPLEMENT_DYNCREATE(CMyGameView1, CView)
CMyGameView1::CMyGameView1()
{
Bitmap.LoadBitmap( IDB_BITMAP );
Bitmap.GetBitmap(&BMPstruct);
}
CMyGameView1::~CMyGameView1()
{
Bitmap.DeleteObject();
}
BEGIN_MESSAGE_MAP(CMyGameView1, CView)
//{{AFX_MSG_MAP(CMyGameView1)
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyGameView1 drawing
void CMyGameView1::OnDraw(CDC* pDC)
{
CMyGameDoc* pDoc = (CMyGameDoc*)GetDocument();
// TODO: add draw code here
CDC *pMemDC = new CDC;
pMemDC->CreateCompatibleDC(pDC);
pMemDC->SelectObject(&Bitmap);
pDC->BitBlt(0, 0, BMPstruct.bmWidth,
BMPstruct.bmHeight, pMemDC, 0, 0,
SRCCOPY );
delete pMemDC;
pDoc->m_client.Draw(pDC);
}
/////////////////////////////////////////////////////////////////////////////
// CMyGameView1 diagnostics
#ifdef _DEBUG
void CMyGameView1::AssertValid() const
{
CView::AssertValid();
}
void CMyGameView1::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMyGameView1 message handlers
void CMyGameView1::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CMyGameDoc* pDoc = (CMyGameDoc*)GetDocument();
pDoc->m_client.MouseClick(point.x, point.y);
CView::OnLButtonDown(nFlags, point);
Invalidate();
}
void CMyGameView1::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
// TODO: Add your specialized code here and/or call the base class
Invalidate();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -