【VC开源代码栏目提醒】:网学会员鉴于大家对VC开源代码十分关注,论文会员在此为大家搜集整理了“ellipsefaceDlg.cpp”一文,供大家参考学习
// ellipsefaceDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ellipseface.h"
#include "ellipsefaceDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEllipsefaceDlg dialog
CEllipsefaceDlg::CEllipsefaceDlg(CWnd* pParent /*=NULL*/)
: CDialog(CEllipsefaceDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CEllipsefaceDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CEllipsefaceDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CEllipsefaceDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CEllipsefaceDlg, CDialog)
//{{AFX_MSG_MAP(CEllipsefaceDlg)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEllipsefaceDlg message handlers
BOOL CEllipsefaceDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// 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
CRgn wndRgn,rgnTemp;
wndRgn.CreateEllipticRgn(0,0,480,300);
SetWindowRgn((HRGN)wndRgn,true);
return TRUE; // return TRUE unless you set the focus to a control
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CEllipsefaceDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CPaintDC dc(this);
CRect rect;
GetWindowRect(&rect);
CDC memDC;
CBitmap cBitmap;
CBitmap* pOldMemBmp=NULL;
cBitmap.LoadBitmap(IDB_BITMAP1);
memDC.CreateCompatibleDC(&dc);
pOldMemBmp=memDC.SelectObject(&cBitmap);
dc.BitBlt(0,0,rect.Width(),rect.Height(),&memDC,0,0,SRCCOPY);
if(pOldMemBmp)memDC.SelectObject(pOldMemBmp);
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CEllipsefaceDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CEllipsefaceDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
::SendMessage(this->GetSafeHwnd(),WM_SYSCOMMAND,SC_MOVE+2,0);
CDialog::OnLButtonDown(nFlags, point);
}
上一篇:
ellipseface.cpp
下一篇:
科研管理杂志简介