// SysMseeage.cpp : implementation file
//

#include "stdafx.h"
#include "ChatServer.h"
#include "SysMseeage.h"

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

/////////////////////////////////////////////////////////////////////////////
// CSysMseeage dialog


CSysMseeage::CSysMseeage(CWnd* pParent /*=NULL*/)
	: CDialog(CSysMseeage::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSysMseeage)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CSysMseeage::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSysMseeage)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
	DDX_Text(pDX, IDC_SYSMSGSERVER , content);
}


BEGIN_MESSAGE_MAP(CSysMseeage, CDialog)
	//{{AFX_MSG_MAP(CSysMseeage)
		// NOTE: the ClassWizard will add message map macros here
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSysMseeage message handlers

void CSysMseeage::SetBitmap(UINT ResID) 
{ 
	mBitmap.LoadBitmap(ResID);
}

HBRUSH CSysMseeage::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{	
	// TODO: Change any attributes of the DC here
	if (mBitmap.GetSafeHandle()!=NULL) 
	{ 
		switch (nCtlColor) 
		{ 
		case CTLCOLOR_STATIC:
			pDC->SetBkMode (TRANSPARENT); 
			return (HBRUSH) mHollowBrush.m_hObject; 
			break; 
		default: 
			HBRUSH hbr = CDialog::OnCtlColor (pDC, pWnd, nCtlColor); 
			return hbr ; 
			break; 
		} 
	}
	else 
	{ 
		HBRUSH hbr = CDialog::OnCtlColor (pDC, pWnd, nCtlColor); 
		return hbr; 
	} 
	// TODO: Return a different brush if the default is not desired
}



BOOL CSysMseeage::OnEraseBkgnd(CDC* pDC) 
{
	// TODO: Add your message handler code here and/or call default
		if (mBitmap.m_hObject!=NULL) 
	{ 
		CDC MemDC; 
		BITMAP bm; 
		CRect Rect;
		int x=0, y=0; 
		GetClientRect (&Rect); 
		mBitmap.GetObject (sizeof(BITMAP),&bm); 
		MemDC.CreateCompatibleDC(pDC); 
		CBitmap* pOldBitmap=MemDC.SelectObject(&mBitmap); 
 
			CDialog::OnEraseBkgnd(pDC); 
			x= (Rect.Width()-bm.bmWidth) /2; 
			y= (Rect.Height()-bm.bmHeight) /2; 
			pDC->BitBlt (x,y,bm.bmWidth,bm.bmHeight, &MemDC, 0, 0, SRCCOPY);
 
		MemDC.SelectObject (pOldBitmap);  
		return TRUE; 
	} 
	else 
		return CDialog::OnEraseBkgnd (pDC); 
	
}