⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bmpwnd.cpp

📁 这是一个打字游戏哦
💻 CPP
字号:
// BmpWnd.cpp : implementation file
//

#include "stdafx.h"
#include "打字游戏.h"
#include "BmpWnd.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern HBITMAP hBitmap[53];
/////////////////////////////////////////////////////////////////////////////
// CBmpWnd

CBmpWnd::CBmpWnd()
{
}

CBmpWnd::~CBmpWnd()
{
}


BEGIN_MESSAGE_MAP(CBmpWnd, CWnd)
	//{{AFX_MSG_MAP(CBmpWnd)
	ON_WM_ERASEBKGND()
	ON_WM_PAINT()
	ON_WM_SETFOCUS()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CBmpWnd message handlers

BOOL CBmpWnd::OnEraseBkgnd(CDC* pDC) 
{
	// TODO: Add your message handler code here and/or call default
	CBrush brush(RGB(0,0,0x66));
	CRect rect;
	GetClientRect(&rect);
	pDC->FillRect(&rect,&brush);
	return TRUE;
}

void CBmpWnd::OnPaint() 
{
	CPaintDC dc(this);
	CBitmap bitmap,*oldBmp;
	BITMAP bm;
	UINT nWindowID=::GetWindowLong(this->m_hWnd,GWL_ID);
	bitmap.Attach(hBitmap[nWindowID-IDB_AB]);

	bitmap.GetObject(sizeof(BITMAP),&bm);
	CDC dcMem;
	dcMem.CreateCompatibleDC(&dc);
	oldBmp=dcMem.SelectObject(&bitmap);
	dc.BitBlt(0,0,bm.bmWidth,bm.bmHeight,&dcMem,0,0,SRCCOPY);
	dcMem.SelectObject(oldBmp);
	bitmap.Detach();
}

void CBmpWnd::OnSetFocus(CWnd* pOldWnd) 
{
	CWnd::OnSetFocus(pOldWnd);
	GetParent()->SetFocus();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -