📄 dgtnumber.cpp
字号:
// DgtNumber.cpp : implementation file
//
#include "stdafx.h"
#include "digit.h"
#include "DgtNumber.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDgtNumber
CDgtNumber::CDgtNumber()
{
}
CDgtNumber::~CDgtNumber()
{
}
BEGIN_MESSAGE_MAP(CDgtNumber, CWnd)
//{{AFX_MSG_MAP(CDgtNumber)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDgtNumber message handlers
BOOL CDgtNumber::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}
BOOL CDgtNumber::Create(CRect re,CWnd* pParentWnd, UINT nID)
{
rect=re;
return Create(NULL,NULL,WS_VISIBLE|WS_CHILD,re,pParentWnd,nID);
}
void CDgtNumber::SetPlayNum(int i)
{
if((i>9)&&(i<0))
{
AfxMessageBox("set number 0-9");
m_disnum=0;
return;
}
m_disnum=i;
Invalidate();
UpdateWindow();
}
void CDgtNumber::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
UINT uiCurrent=IDB_BITMAP0+m_disnum;
GetWindowRect(rect);
CDC dcMem;
dcMem.CreateCompatibleDC(&dc);
CBitmap m_Bitmap;
m_Bitmap.LoadBitmap(uiCurrent);
dcMem.SelectObject(m_Bitmap);
BITMAP pb;
m_Bitmap.GetBitmap(&pb);
int icbwidth=pb.bmWidth;
int icbheight=pb.bmHeight;
::StretchBlt(dc.m_hDC,0,0,rect.Width(),rect.Height(),dcMem.GetSafeHdc(),0,0,icbwidth,icbheight,SRCCOPY);//MERGECOPY);
// Do not call CWnd::OnPaint() for painting messages
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -