mybuttona.cpp

来自「用VC编的电子日记软件」· C++ 代码 · 共 55 行

CPP
55
字号
// MyButtona.cpp : implementation file
//

#include "stdafx.h"
#include "testd.h"
#include "MyButtona.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMyButtona

CMyButtona::CMyButtona()
{
	color=RGB(255,255,255);
		
}

CMyButtona::~CMyButtona()
{
}


BEGIN_MESSAGE_MAP(CMyButtona, CButton)
	//{{AFX_MSG_MAP(CMyButtona)
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyButtona message handlers

void CMyButtona::DrawItem(LPDRAWITEMSTRUCT lps) 
{
	// TODO: Add your code to draw the specified item
	CDC *dc=CDC::FromHandle(lps->hDC);
	CRect rect;
	rect.CopyRect(&lps->rcItem);
    CBrush br(color);
	dc->FillRect(&rect,&br);
	SetTimer(1,10,NULL);
}

void CMyButtona::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	InvalidateRect(NULL,false);
	KillTimer(1);
	CButton::OnTimer(nIDEvent);
}

⌨️ 快捷键说明

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