typebutton.cpp

来自「电脑编程技巧和源码。很不错的。」· C++ 代码 · 共 60 行

CPP
60
字号
// TypeButton.cpp : implementation file
//

#include "stdafx.h"
#include "Monitor.h"
#include "TypeButton.h"

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

/////////////////////////////////////////////////////////////////////////////
// CTypeButton

CTypeButton::CTypeButton()
{
}

CTypeButton::~CTypeButton()
{
}


BEGIN_MESSAGE_MAP(CTypeButton, CButton)
	//{{AFX_MSG_MAP(CTypeButton)
	ON_CONTROL_REFLECT(BN_CLICKED, OnClicked)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTypeButton message handlers

void CTypeButton::OnClicked() 
{
	// TODO: Add your control notification handler code here
	int qwert=GetDlgCtrlID();	
}

BOOL CTypeButton::SetTextColor(COLORREF clrText)
{
	m_clrText=clrText;
	return TRUE;
}

void CTypeButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 
{
	// TODO: Add your code to draw the specified item
	CDC dc;
	RECT rc;
	CString strText;
	dc.Attach(lpDrawItemStruct->hDC);
	rc=lpDrawItemStruct->rcItem;
	GetWindowText(strText);
	
	dc.SetTextColor(m_clrText);
	dc.DrawText(strText,&rc,DT_CENTER | DT_VCENTER | DT_SINGLELINE);
}

⌨️ 快捷键说明

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