// OnCastDlg.cpp : implementation file
//

#include "stdafx.h"
#include "TouchBoard.h"
#include "OnCastDlg.h"
#include "afxdialogex.h"
#include "TouchBoardDlg.h"

extern CTouchBoardDlg *g_pMainDlg;
// COnCastDlg dialog

IMPLEMENT_DYNAMIC(COnCastDlg, CDialogEx)

COnCastDlg::COnCastDlg(CWnd* pParent /*=NULL*/)
	: CDialogEx(COnCastDlg::IDD, pParent)
{

	EnableAutomation();

}

COnCastDlg::~COnCastDlg()
{
}

void COnCastDlg::OnFinalRelease()
{
	// When the last reference for an automation object is released
	// OnFinalRelease is called.  The base class will automatically
	// deletes the object.  Add additional cleanup required for your
	// object before calling the base class.

	CDialogEx::OnFinalRelease();
}

void COnCastDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(COnCastDlg, CDialogEx)
	ON_WM_PAINT()
END_MESSAGE_MAP()

BEGIN_DISPATCH_MAP(COnCastDlg, CDialogEx)
END_DISPATCH_MAP()

// Note: we add support for IID_IOnCastDlg to support typesafe binding
//  from VBA.  This IID must match the GUID that is attached to the 
//  dispinterface in the .IDL file.

// {3BFB7ADB-C3C9-4EDB-8DEE-BB352084EDB3}
static const IID IID_IOnCastDlg =
{ 0x3BFB7ADB, 0xC3C9, 0x4EDB, { 0x8D, 0xEE, 0xBB, 0x35, 0x20, 0x84, 0xED, 0xB3 } };

BEGIN_INTERFACE_MAP(COnCastDlg, CDialogEx)
	INTERFACE_PART(COnCastDlg, IID_IOnCastDlg, Dispatch)
END_INTERFACE_MAP()


// COnCastDlg message handlers


void COnCastDlg::OnPaint()
{
	CPaintDC dc(this); // device context for painting
	// TODO: Add your message handler code here
	// Do not call CDialogEx::OnPaint() for painting messages

	CFont *pOldFont;
	dc.SetBkMode( TRANSPARENT );
	pOldFont = dc.SelectObject(&g_pMainDlg->m_topFont);
	RECT txtPos;
	GetClientRect(&txtPos);
	txtPos.top = 70;
	txtPos.bottom = 200;
	if(m_strMessage.GetLength() > 0)
		dc.DrawText(m_strMessage, -1, &txtPos, DT_CENTER);

	dc.SelectObject(pOldFont);
}
