123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- // ShowPhoto.cpp : implementation file
- //
- #include "stdafx.h"
- #include "dbserver.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 ();
- DEVMODE g_dm;
- g_dm.dmSize = sizeof(DEVMODE) ;
- EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&g_dm);
-
- rc=CRect(0,0,g_dm.dmPelsWidth,g_dm.dmPelsHeight-hei);
- MoveWindow(rc);
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- extern void RectFitDes(int width, int height, CRect &rc);
- 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
- }
|