MyButton.cpp
资源名称:Fly ight.zip [点击查看]
上传用户:baina_li
上传日期:2013-03-23
资源大小:960k
文件大小:1k
源码类别:
射击游戏
开发平台:
Visual C++
- // MyButton.cpp : implementation file
- //
- #include "stdafx.h"
- #include "fighter.h"
- #include "MyButton.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CMyButton
- CMyButton::CMyButton()
- {
- }
- CMyButton::~CMyButton()
- {
- }
- BEGIN_MESSAGE_MAP(CMyButton, CButton)
- //{{AFX_MSG_MAP(CMyButton)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CMyButton message handlers
- void CMyButton::SetMyBitmap(UINT nID)
- {
- m_bmp.LoadBitmap(nID);
- }
- void CMyButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
- {
- // TODO: Add your code to draw the specified item
- CDC dc;
- dc.Attach( lpDrawItemStruct->hDC );
- CRect rc;
- GetClientRect(rc);
- CDC m_dc;
- m_dc.CreateCompatibleDC(&dc);
- m_dc.SelectObject(&m_bmp);
- if(lpDrawItemStruct->itemState & ODS_SELECTED)
- {
- dc.BitBlt(1, 1, 60, 25, &m_dc, 0, 0, SRCCOPY);
- }
- else
- {
- dc.BitBlt(0, 0, 60, 25, &m_dc, 0, 0, SRCCOPY);
- }
- }