1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- // DlgBase.cpp : implementation file
- //
- #include "stdafx.h"
- #include "IDE.h"
- #include "DlgBase.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CDlgBase dialog
- CDlgBase::CDlgBase(UINT nID,CWnd* pParent /*=NULL*/)
- : CDialog(nID, pParent)
- {
- //{{AFX_DATA_INIT(CDlgBase)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- }
- void CDlgBase::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CDlgBase)
- // NOTE: the ClassWizard will add DDX and DDV calls here
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CDlgBase, CDialog)
- //{{AFX_MSG_MAP(CDlgBase)
- ON_WM_PAINT()
- ON_WM_NCHITTEST()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CDlgBase message handlers
- BOOL CDlgBase::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- // TODO: Add extra initialization here
- /*将窗体大小调整到位图大小一样*/
- m_bmp.LoadBitmap(IDB_CONTROL);
- BITMAP bm;
- m_bmp.GetBitmap(&bm);
- CRect rtWindow;
- GetWindowRect(&rtWindow);
- rtWindow.right = rtWindow.left+bm.bmWidth;
- rtWindow.bottom =rtWindow.top +bm.bmHeight;
- MoveWindow(&rtWindow);
-
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CDlgBase::OnPaint()
- {
- CPaintDC dc(this); // device context for painting
-
- // TODO: Add your message handler code here
- CDC picDC;
- picDC.CreateCompatibleDC (&dc);
-
- CBitmap *pOldBmp;
- pOldBmp = picDC.SelectObject (&m_bmp);
-
- BITMAP bm;
- m_bmp.GetBitmap(&bm);
-
-
- dc.BitBlt (0,0,bm.bmWidth ,bm.bmHeight,&picDC,0,0,SRCCOPY);
- dc.SelectObject(pOldBmp);
- //2011-11-02 add
- ReleaseDC( &picDC );
- ReleaseDC( &dc );
- // Do not call CDialog::OnPaint() for painting messages
- }
- LRESULT CDlgBase::OnNcHitTest(CPoint point)
- {
- // TODO: Add your message handler code here and/or call default
- LRESULT nResult = CDialog::OnNcHitTest(point);
-
- return nResult == HTCLIENT ? HTCAPTION : nResult;
- }
|