www.pudn.com > Face3DModel.zip > SelectMarkerDlg.cpp


// SelectMarkerDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "Face3DModel.h" 
#include "SelectMarkerDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CSelectMarkerDlg dialog 
 
 
CSelectMarkerDlg::CSelectMarkerDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CSelectMarkerDlg::IDD, pParent) 
    , m_pBmpInfoHeader(NULL) 
    , m_pBmpSnap(NULL) 
{ 
	//{{AFX_DATA_INIT(CSelectMarkerDlg) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
} 
 
 
void CSelectMarkerDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CSelectMarkerDlg) 
		// NOTE: the ClassWizard will add DDX and DDV calls here 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CSelectMarkerDlg, CDialog) 
	//{{AFX_MSG_MAP(CSelectMarkerDlg) 
	ON_WM_PAINT() 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CSelectMarkerDlg message handlers 
 
void CSelectMarkerDlg::OnPaint()  
{ 
	CPaintDC dc(this); // device context for painting 
    if (m_pBmpInfoHeader != NULL && m_pBmpSnap != NULL) 
    { 
        CRect rc; 
        GetClientRect(&rc); 
        int oldMode = SetStretchBltMode(dc.m_hDC, COLORONCOLOR); 
        StretchDIBits(dc.m_hDC, 
            (rc.Width() - m_pBmpInfoHeader->biWidth) / 2, 
            (rc.Height() - m_pBmpInfoHeader->biHeight - 40) / 2, 
            m_pBmpInfoHeader->biWidth, m_pBmpInfoHeader->biHeight, 
            0, 0, m_pBmpInfoHeader->biWidth, m_pBmpInfoHeader->biHeight, 
            m_pBmpSnap, 
            reinterpret_cast(m_pBmpInfoHeader), 
            DIB_RGB_COLORS, 
            SRCCOPY); 
        SetStretchBltMode(dc.m_hDC, oldMode); 
    } 
} 
 
void CSelectMarkerDlg::SetSnapBitmap(BITMAPINFOHEADER *pBmpInfoHeader, BYTE *pBmpSnap) 
{ 
    ASSERT(pBmpInfoHeader != NULL); 
    ASSERT(pBmpSnap != NULL); 
 
    m_pBmpInfoHeader = pBmpInfoHeader; 
    m_pBmpSnap = pBmpSnap; 
}