www.pudn.com > RayTrace1.1.rar > ShowTracedPicture.cpp
// ShowTracedPicture.cpp : implementation file
//
#include "stdafx.h"
#include "noname.h"
#include "ShowTracedPicture.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CShowTracedPicture dialog
CShowTracedPicture::CShowTracedPicture(CWnd* pParent /*=NULL*/)
: CDialog(CShowTracedPicture::IDD, pParent)
{
m_nWndWidth = SCRWIDTH;
m_nWndHeight= SCRHEIGHT;
m_Buffer=NULL;
}
CShowTracedPicture::~CShowTracedPicture()
{
if( m_Buffer==NULL)
{
return;
}
for(int i=0;iGetWindow());
if(m_pResMap!=NULL) delete m_pResMap;
m_pResMap=new CBitmap();
m_pResMap->CreateCompatibleBitmap(&ClientDC,m_nWndWidth,m_nWndHeight);
CDC dc;
dc.CreateCompatibleDC(&ClientDC);
dc.SelectObject(m_pResMap);
for(int i=0; iGetWindow()->GetClientRect(&rc);
pDCShow->Rectangle(&rc);
CDC dc;
CBitmap *pOldBitmap;
dc.CreateCompatibleDC(pDCShow);
pOldBitmap=dc.SelectObject(m_pResMap);
pDCShow->StretchBlt(0,0,m_nWndWidth,m_nWndHeight,&dc,0,0,m_nWndWidth,m_nWndHeight,SRCCOPY);
dc.SelectObject(pOldBitmap);
dc.DeleteDC();
}
BOOL CShowTracedPicture::OnInitDialog()
{
CDialog::OnInitDialog();
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// 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
CWnd *pWnd0= GetDlgItem(IDC_ShowTracedPicture);
pDCShow = pWnd0->GetDC();
// m_pMainDib = new CDib();
m_tOriPixelArray = NULL;
m_pResMap = NULL;
MakeBitMap();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CShowTracedPicture::OnBUTTONShowPic()
{
MakeBitMap();
}
void CShowTracedPicture::OnPaint()
{
CPaintDC dc(this); // device context for painting
MakeBitMap();
// Do not call CDialog::OnPaint() for painting messages
}