www.pudn.com > BitmapExample.rar > ShowResult.cpp
// ShowResult.cpp : implementation file
//
#include "stdafx.h"
#include "bitmapexample.h"
#include "ShowResult.h"
#include "Dib.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CShowResult dialog
extern CString dibpath;
extern int dibwidth;
extern int dibheight;
CShowResult::CShowResult(CWnd* pParent /*=NULL*/)
: CDialog(CShowResult::IDD, pParent)
{
//{{AFX_DATA_INIT(CShowResult)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CShowResult::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CShowResult)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CShowResult, CDialog)
//{{AFX_MSG_MAP(CShowResult)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CShowResult message handlers
void CShowResult::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
CDC *pDc=this->GetDC();
//加载位图并显示之
CDib dib;
if (dib.Load("E:/new77.bmp"))
{
dib.SetPalette(pDc);
dib.Draw(pDc);
MoveWindow(300,0,
dibwidth+GetSystemMetrics(SM_CXSIZEFRAME),GetSystemMetrics(SM_CYCAPTION)+GetSystemMetrics(SM_CYSIZEFRAME)+dibheight,TRUE);
//MoveWindow(0,GetSystemMetrics(SM_CYSCREEN)-(2*GetSystemMetrics(SM_CYCAPTION)+GetSystemMetrics(SM_CYSIZEFRAME)+dibheight),
//dibwidth+GetSystemMetrics(SM_CXSIZEFRAME),GetSystemMetrics(SM_CYCAPTION)+GetSystemMetrics(SM_CYSIZEFRAME)+dibheight,TRUE);
}
// Do not call CDialog::OnPaint() for painting messages
}
BOOL CShowResult::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
}