Click here to Skip to main content
15,896,429 members
Articles / Programming Languages / C++

BasicAdmin2 - Personal Finance Software

Rate me:
Please Sign up or sign in to vote.
4.58/5 (8 votes)
4 Nov 2011CPOL3 min read 39K   5.9K   33  
Utility to keep track of your finances
// FrmMensajeBox.cpp : implementation file
//

#include "stdafx.h"
#include "FrmMensajeBox.h"
#include "Utils.h"

// CFrmMensajeBox dialog

IMPLEMENT_DYNAMIC(CFrmMensajeBox, CDialog)

CFrmMensajeBox::CFrmMensajeBox(CWnd* pParent /*=NULL*/)
	: CDialog(CFrmMensajeBox::IDD, pParent)
{

}

CFrmMensajeBox::~CFrmMensajeBox()
{
}

void CFrmMensajeBox::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDACEPTAR1, BtnOK);
	DDX_Control(pDX, IDCANCELAR1, BtnCancel);
}


BEGIN_MESSAGE_MAP(CFrmMensajeBox, CDialog)
	ON_WM_CTLCOLOR()
	ON_WM_PAINT()
	ON_WM_ERASEBKGND()
	ON_BN_CLICKED(IDCANCELAR1, OnBnClickedCancelar)
	ON_BN_CLICKED(IDACEPTAR1, OnBnClickedAceptar)
END_MESSAGE_MAP()


// CFrmMensajeBox message handlers

void CFrmMensajeBox::OnBnClickedAceptar()
{
	OnOK();
}

void CFrmMensajeBox::OnBnClickedCancelar()
{
	OnCancel();
}
HBRUSH CFrmMensajeBox::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	int nID = pWnd->GetDlgCtrlID();
	
	switch (nID)
    {
		case LBLDESCRIPCIONA:
	//	case IDC_IMAGEN:
			pDC->SetBkMode(OPAQUE);
			pDC->SetBkColor(DarColor(m_nAppLook));
			return (HBRUSH) GetStockObject(NULL_BRUSH);
/*		case IDC_IMAGEN:
			pDC->SetBkMode(TRANSPARENT);
			pDC->SetBkColor(DarColor());
			CBrush a(DarColor());
			return a;*/
	}
	return hbr;
}
void CFrmMensajeBox::OnPaint()
{
	if (IsIconic())
	{
		CPaintDC dc(this); 
	}
	else
	{
		CDialog::OnPaint();
		CClientDC dc(this);
		dc.DrawIcon(10, 15, m_hStaticIcon);
	}
}

BOOL CFrmMensajeBox::OnEraseBkgnd(CDC* pDC)
{
	CRect rect;
	GetClientRect(&rect);
	pDC->FillSolidRect(0,0,rect.Width(),rect.Height(),DarColor(m_nAppLook));
	return TRUE;

}
BOOL CFrmMensajeBox::OnInitDialog()
{
	CDialog::OnInitDialog();
	if (!AceptaCancela)
		m_hStaticIcon = ::LoadIcon(AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_MODIFY));
	else
		m_hStaticIcon = ::LoadIcon(AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_DELETE));

	CUtils ut;
	ut.FormatButtonsOKCancel(&BtnOK, &BtnCancel,m_nAppLook);
	GetDlgItem(LBLDESCRIPCIONA)->SetWindowTextW(Mensaje);
	this->SetWindowTextW(Titulo);
	if (!AceptaCancela)
	{
		BtnCancel.ShowWindow(SW_HIDE);
		CRect rect;
		BtnOK.GetWindowRect(&rect);
		ScreenToClient(&rect);
		BtnOK.MoveWindow(rect.left + 65, rect.top, rect.Width(), rect.Height());
	}
	return TRUE;
}

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Argentina Argentina
System developer from Argentina.

Programmed in VB 5,6,.NET, C#, Java, PL-SQL, Transac-SQL, C, C++ and even some "calculator" language.

Love to build small, useful applications.
Usually building big and complicated apps based on solid, reliable components.

Hobbies: reading, photography, chess, paddle, running.

Comments and Discussions