www.pudn.com > BitmapExample.rar > ShowMaskDlg.cpp


// ShowMaskDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "BitmapExample.h" 
#include "ShowMaskDlg.h" 
#include "Dib.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CShowMaskDlg dialog 
extern CString maskpath; 
extern int dibwidth; 
extern int dibheight; 
 
 
CShowMaskDlg::CShowMaskDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CShowMaskDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CShowMaskDlg) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
} 
 
 
void CShowMaskDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CShowMaskDlg) 
		// NOTE: the ClassWizard will add DDX and DDV calls here 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CShowMaskDlg, CDialog) 
	//{{AFX_MSG_MAP(CShowMaskDlg) 
	ON_WM_PAINT() 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CShowMaskDlg message handlers 
 
void CShowMaskDlg::OnPaint()  
{ 
	CPaintDC dc(this); // device context for painting 
	 
	// TODO: Add your message handler code here 
		CDC *pDc=this->GetDC(); 
	 
	//加载位图并显示之 
	CDib dib; 
 
	if (dib.Load(maskpath)) 
		{ 
			dib.SetPalette(pDc); 
			dib.Draw(pDc); 
             
			MoveWindow(0,200,dibwidth+GetSystemMetrics(SM_CXSIZEFRAME), 
				GetSystemMetrics(SM_CYCAPTION)+GetSystemMetrics(SM_CYSIZEFRAME)+dibheight,TRUE); 
 
		} 
	// Do not call CDialog::OnPaint() for painting messages 
} 
 
BOOL CShowMaskDlg::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
	 
	// TODO: Add extra initialization here 
	Invalidate(); 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
}