106 lines
2.5 KiB
C++
106 lines
2.5 KiB
C++
|
// TestImageDlg.cpp : implementation file
|
||
|
//
|
||
|
|
||
|
#include "stdafx.h"
|
||
|
#include "TestImage.h"
|
||
|
#include "TestImageDlg.h"
|
||
|
|
||
|
#ifdef _DEBUG
|
||
|
#define new DEBUG_NEW
|
||
|
#undef THIS_FILE
|
||
|
static char THIS_FILE[] = __FILE__;
|
||
|
#endif
|
||
|
|
||
|
/////////////////////////////////////////////////////////////////////////////
|
||
|
// CTestImageDlg dialog
|
||
|
|
||
|
CTestImageDlg::CTestImageDlg(CWnd* pParent /*=NULL*/)
|
||
|
: CDialog(CTestImageDlg::IDD, pParent)
|
||
|
{
|
||
|
//{{AFX_DATA_INIT(CTestImageDlg)
|
||
|
// NOTE: the ClassWizard will add member initialization here
|
||
|
//}}AFX_DATA_INIT
|
||
|
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
|
||
|
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
||
|
m_pOldBitmap = NULL;
|
||
|
m_InitDC = FALSE;
|
||
|
}
|
||
|
|
||
|
void CTestImageDlg::DoDataExchange(CDataExchange* pDX)
|
||
|
{
|
||
|
CDialog::DoDataExchange(pDX);
|
||
|
//{{AFX_DATA_MAP(CTestImageDlg)
|
||
|
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||
|
//}}AFX_DATA_MAP
|
||
|
}
|
||
|
|
||
|
BEGIN_MESSAGE_MAP(CTestImageDlg, CDialog)
|
||
|
//{{AFX_MSG_MAP(CTestImageDlg)
|
||
|
ON_WM_TIMER()
|
||
|
ON_WM_ERASEBKGND()
|
||
|
ON_WM_PAINT()
|
||
|
//}}AFX_MSG_MAP
|
||
|
END_MESSAGE_MAP()
|
||
|
|
||
|
/////////////////////////////////////////////////////////////////////////////
|
||
|
// CTestImageDlg message handlers
|
||
|
|
||
|
BOOL CTestImageDlg::OnInitDialog()
|
||
|
{
|
||
|
CDialog::OnInitDialog();
|
||
|
|
||
|
// Set the icon for this dialog. The framework does this automatically
|
||
|
// when the application's main window is not a dialog
|
||
|
SetIcon(m_hIcon, TRUE); // Set big icon
|
||
|
SetIcon(m_hIcon, FALSE); // Set small icon
|
||
|
|
||
|
CenterWindow(GetDesktopWindow()); // center to the hpc screen
|
||
|
|
||
|
// TODO: Add extra initialization here
|
||
|
MoveWindow(0,0,320,240);
|
||
|
SetTimer(1,5000,NULL);
|
||
|
return TRUE; // return TRUE unless you set the focus to a control
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
void CTestImageDlg::OnTimer(UINT nIDEvent)
|
||
|
{
|
||
|
// TODO: Add your message handler code here and/or call default
|
||
|
|
||
|
CDialog::OnTimer(nIDEvent);
|
||
|
}
|
||
|
|
||
|
BOOL CTestImageDlg::OnEraseBkgnd(CDC* pDC)
|
||
|
{
|
||
|
// TODO: Add your message handler code here and/or call default
|
||
|
if (!m_InitDC)
|
||
|
{
|
||
|
m_MemDC.CreateCompatibleDC(pDC);
|
||
|
m_InitDC = TRUE;
|
||
|
}
|
||
|
return CDialog::OnEraseBkgnd(pDC);
|
||
|
}
|
||
|
|
||
|
void CTestImageDlg::OnPaint()
|
||
|
{
|
||
|
CPaintDC dc(this); // device context for painting
|
||
|
|
||
|
// TODO: Add your message handler code here
|
||
|
if (m_MemDC.m_hDC != NULL)
|
||
|
{
|
||
|
if (m_pOldBitmap)
|
||
|
{
|
||
|
m_MemDC.SelectObject(m_pOldBitmap);
|
||
|
}
|
||
|
|
||
|
if (m_hBitmap)
|
||
|
{
|
||
|
m_pOldBitmap = m_MemDC.SelectObject(m_hBitmap);
|
||
|
}
|
||
|
|
||
|
dc.StretchBlt(0,0,320,240,&m_MemDC,0,0,1024,768,SRCCOPY);
|
||
|
}
|
||
|
// Do not call CDialog::OnPaint() for painting messages
|
||
|
}
|