📄 newbutton.cpp
字号:
// NewButton.cpp : implementation file
//
#include "stdafx.h"
#include "TransButton.h"
#include "NewButton.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CNewButton
CNewButton::CNewButton()
{
}
CNewButton::~CNewButton()
{
}
BEGIN_MESSAGE_MAP(CNewButton, CButton)
//{{AFX_MSG_MAP(CNewButton)
ON_WM_ERASEBKGND()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CNewButton message handlers
void CNewButton::PreSubclassWindow()
{
// TODO: Add your specialized code here and/or call the base class
SetButtonStyle(GetButtonStyle() | BS_OWNERDRAW);
// CButton::PreSubclassWindow();
}
void CNewButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
// TODO: Add your code to draw the specified item
Refresh();
}
BOOL CNewButton::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
CRect clientRect;
GetClientRect(&clientRect);
int cx=clientRect.Width ();
int cy=clientRect.Height ();
// Store our orignal DC.
CBitmap bitmap;
// memDC.CreateDC(pDC);
bitmap.CreateCompatibleBitmap (pDC,cx,cy);
memDC.SelectObject (&bitmap);
memDC.BitBlt (0,0,cx,cy,pDC,0,0,SRCCOPY);
// m_bDCStored=true;
// }
// We'll not erase our button's back ground.
return TRUE;
}
void CNewButton::Refresh()
{
CRect rect;
GetClientRect(&rect);
CClientDC dc(this);
// if(m_bBkTransparent==false)
// dc.FillRect(&rect,&CBrush(::GetSysColor(COLOR_BTNFACE)) );
// else
dc.BitBlt (0,0,rect.Width (),rect.Height (),&memDC,0,0,SRCCOPY);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -