// BaseDialog.cpp : implementation file
//
#include "stdafx.h"
#include "AsCfgBuilder.h"
#include "BaseDialog.h"
#include "MemDC.h"
#include "GuiDefs.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBaseDialog dialog
CBaseDialog::CBaseDialog(UINT nIDTemplate, CWnd* pParent /*=NULL*/)
: CDialog(nIDTemplate, pParent)
{
//{{AFX_DATA_INIT(CBaseDialog)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CBaseDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CBaseDialog)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CBaseDialog, CDialog)
//{{AFX_MSG_MAP(CBaseDialog)
ON_WM_PAINT()
ON_WM_CTLCOLOR()
ON_WM_ERASEBKGND()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBaseDialog message handlers
void CBaseDialog::OnPaint()
{
CPaintDC dc(this); // device context for painting
CMemDC memDC(&dc);
DrawBackground(memDC);
}
HBRUSH CBaseDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if (bkBrush_.GetSafeHandle() == NULL)
bkBrush_.CreateSolidBrush(DIALOG_BACK_COLOR);
if (editBrush_.GetSafeHandle() == NULL)
editBrush_.CreateSolidBrush(DIALOG_EDITBOX_BACK_COLOR);
if (nCtlColor == CTLCOLOR_STATIC) {
pDC->SetBkMode(OPAQUE);
pDC->SetBkColor(DIALOG_BACK_COLOR);
return bkBrush_;
} else if (nCtlColor == CTLCOLOR_EDIT) {
pDC->SetTextColor(DIALOG_EDITBOX_FORE_COLOR);
pDC->SetBkColor(DIALOG_EDITBOX_BACK_COLOR);
pDC->SetBkMode(OPAQUE);
return editBrush_;
}
return hbr;
}
BOOL CBaseDialog::OnEraseBkgnd(CDC* pDC)
{
return TRUE;
}
void CBaseDialog::DrawBackground(CDC* pDC)
{
CBrush b(DIALOG_BACK_COLOR);
CRect rc;
GetClientRect(rc);
pDC->FillRect(rc, &b);
}