|
// ColoredDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ColoredDlg.h"
// CColoredDlg dialog
IMPLEMENT_DYNAMIC(CColoredDlg, CDialog)
CColoredDlg::CColoredDlg(CWnd* pParent /*=NULL*/)
// : CDialog(CColoredDlg::IDD, pParent)
{
//default brush
m_brBkg.CreateSolidBrush(RGB_AVERAGE(GetSysColor(COLOR_ACTIVECAPTION), RGB(255, 255, 255)));
}
CColoredDlg::CColoredDlg(UINT nDialogID, CWnd* pParent /* = NULL */)
{
m_pParentWnd = pParent;
m_lpszTemplateName = MAKEINTRESOURCE(nDialogID);
m_nIDHelp = nDialogID;
//default brush
m_brBkg.CreateSolidBrush(RGB_AVERAGE(GetSysColor(COLOR_ACTIVECAPTION), RGB(255, 255, 255)));
}
CColoredDlg::~CColoredDlg()
{
}
BEGIN_MESSAGE_MAP(CColoredDlg, CDialog)
ON_WM_CTLCOLOR()
END_MESSAGE_MAP()
// CColoredDlg message handlers
//////////////////////////////////////////////////////////////////////////
HBRUSH CColoredDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
//we can set up the control's painting DC here.
pDC->SetBkColor(m_crBkg);
pDC->SetTextColor(m_crFrg);
pDC->SetBkMode(OPAQUE);
//and return a background brush
return m_brBkg;
}
//////////////////////////////////////////////////////////////////////////
void CColoredDlg::SetBkgColor(COLORREF crBkg)
{
m_crBkg=crBkg;
//re-create bkg brush
m_brBkg.DeleteObject();
m_brBkg.CreateSolidBrush(crBkg);
}
//////////////////////////////////////////////////////////////////////////
void CColoredDlg::SetFrgColor(COLORREF crFrg)
{
m_crFrg=crFrg;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I'm a 29-year old software developer. I began programming on a ZX Spectrum many years ago. I've programmed a number of high level languages (Basic, Pascal, C/C++, Java, Php, Perl, C#). I also like reverse-engineering and assembler programming.
I'm interested in handheld devices programming, especially Windows Mobile devices.