// ShowPhoto.cpp : implementation file // #include "stdafx.h" #include "ylgl.h" #include "ShowPhoto.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // ShowPhoto dialog ShowPhoto::ShowPhoto(CWnd* pParent /*=NULL*/) : CDialog(ShowPhoto::IDD, pParent) { //{{AFX_DATA_INIT(ShowPhoto) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } void ShowPhoto::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(ShowPhoto) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(ShowPhoto, CDialog) //{{AFX_MSG_MAP(ShowPhoto) ON_WM_PAINT() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // ShowPhoto message handlers BOOL ShowPhoto::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here CRect rc; HWND wnd = ::FindWindow("Shell_TrayWnd", 0); ::GetWindowRect (wnd, &rc); int hei=rc.Height (); rc=CRect(0,0,g_screenwid,g_screenhei-hei); MoveWindow(rc); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void ShowPhoto::OnPaint() { CPaintDC dc(this); // device context for painting // TODO: Add your message handler code here if(m_pImg) { CRect rc; GetClientRect(rc); RectFitDes(m_pImg->GetWidth(), m_pImg->GetHeight(), rc); Graphics dcgraph(dc.GetSafeHdc()); Rect destinationRect(rc.left , rc.top , rc.Width (), rc.Height ()); dcgraph.DrawImage(m_pImg, destinationRect, 0,0,m_pImg->GetWidth(), m_pImg->GetHeight(),UnitPixel); } // Do not call CDialog::OnPaint() for painting messages }