⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stye_clordlg.cpp

📁 EVC下BUTTON和STATIC内文字颜色的改变
💻 CPP
字号:
// stye_clorDlg.cpp : implementation file
//
#include "stdafx.h"
#include "stye_clor.h"
#include "stye_clorDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CStye_clorDlg dialog

CStye_clorDlg::CStye_clorDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CStye_clorDlg::IDD, pParent)
{
		m_HollowBrush.CreateStockObject(HOLLOW_BRUSH);

		m_BkGndBmp.LoadBitmap(IDB_BMP_BKGND);
	//{{AFX_DATA_INIT(CStye_clorDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
CStye_clorDlg::~CStye_clorDlg()
{
	m_HollowBrush.DeleteObject();
	m_BkGndBmp.DeleteObject();
}
void CStye_clorDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CStye_clorDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CStye_clorDlg, CDialog)
	//{{AFX_MSG_MAP(CStye_clorDlg)
	ON_WM_CTLCOLOR()
    ON_WM_ERASEBKGND()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CStye_clorDlg message handlers

BOOL CStye_clorDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	CenterWindow(GetDesktopWindow());	// center to the hpc screen

	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}



HBRUSH CStye_clorDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
		if(nCtlColor == CTLCOLOR_BTN || nCtlColor == CTLCOLOR_STATIC)
	{
		pDC->SetTextColor(RGB(255,0,255));
		pDC->SetBkMode(TRANSPARENT);
		return (HBRUSH)m_HollowBrush;
	}
	// TODO: Change any attributes of the DC here
	
	// TODO: Return a different brush if the default is not desired
	return hbr;
}
BOOL CStye_clorDlg::OnEraseBkgnd(CDC* pDC) 
{
	CRect rcClient;
	GetClientRect(&rcClient);
	BITMAP bm;
	m_BkGndBmp.GetBitmap(&bm);
	CDC memDC;
	memDC.CreateCompatibleDC(pDC);
	CBitmap *pOldBmp = memDC.SelectObject(&m_BkGndBmp);
	pDC->StretchBlt(0,0,rcClient.Width(),rcClient.Height(),&memDC,0,0,bm.bmWidth,bm.bmHeight,SRCCOPY);
	memDC.SelectObject(pOldBmp);
	memDC.DeleteDC();
	return TRUE;
	
//	return CDialog::OnEraseBkgnd(pDC);
}

⌨️ 快捷键说明

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