【VC开源代码栏目提醒】:网学会员VC开源代码为您提供FixYouDlg.cpp参考,解决您在FixYouDlg.cpp学习中工作中的难题,参考学习。
// FixYouDlg.cpp : implementation file
//
//
//功能:退出程序对话框
//
#include "stdafx.h"
#include "FixYou.h"
#include "FixYouDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFixYouDlg dialog
CFixYouDlg::CFixYouDlg(CWnd* pParent /*=NULL*/)
: CDialog(CFixYouDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CFixYouDlg)
// 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 CFixYouDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CFixYouDlg)
DDX_Control(pDX, IDOK, m_NoPlay);
DDX_Control(pDX, IDCANCEL, m_Play);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CFixYouDlg, CDialog)
//{{AFX_MSG_MAP(CFixYouDlg)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_MOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFixYouDlg message handlers
BOOL CFixYouDlg::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
//设置位图按钮
m_NoPlay.LoadBitmaps(IDB_BMPBTN,6, 1, 1, 1, 1 );
m_NoPlay.SetFontColor(RGB(240,200,90));
m_Play.LoadBitmaps(IDB_BMPBTN,6, 1, 1, 1, 1 );
m_Play.SetFontColor(RGB(240,200,90));
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 CFixYouDlg::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
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CFixYouDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
BOOL CFixYouDlg::DestroyWindow()
{
ClipCursor(NULL); //恢复鼠标正常显示
return CDialog::DestroyWindow();
}
void CFixYouDlg::OnMove(int x, int y)
{
CDialog::OnMove(x, y);
//限定鼠标只能在对话框内部移动
CRect rct;
GetWindowRect(rct);
ClipCursor(rct);
}
上一篇:
FixYou.cpp
下一篇:
政府形象媒体危机的处置策略研究