126 lines
2.9 KiB
C++
Executable File
126 lines
2.9 KiB
C++
Executable File
// PowerDlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "gpsmain.h"
|
|
#include "PowerDlg.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CPowerDlg dialog
|
|
|
|
|
|
CPowerDlg::CPowerDlg(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CPowerDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CPowerDlg)
|
|
// NOTE: the ClassWizard will add member initialization here
|
|
//}}AFX_DATA_INIT
|
|
// 初始化背景画刷
|
|
CBitmap tmpBmp;
|
|
// 从资源中加载背景图片
|
|
tmpBmp.LoadBitmap(IDB_SETPOWER_WND);
|
|
|
|
// 建立背景画刷
|
|
m_BgBrush.CreatePatternBrush(&tmpBmp);
|
|
|
|
tmpBmp.DeleteObject();
|
|
}
|
|
|
|
CPowerDlg::~CPowerDlg()
|
|
{
|
|
m_BgBrush.DeleteObject();
|
|
}
|
|
|
|
void CPowerDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CPowerDlg)
|
|
DDX_Control(pDX, IDC_BUTTON_POWER_EXIT, m_butExit);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CPowerDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CPowerDlg)
|
|
ON_WM_CTLCOLOR()
|
|
ON_WM_PAINT()
|
|
ON_BN_CLICKED(IDC_BUTTON_POWER_EXIT, OnButtonPowerExit)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CPowerDlg message handlers
|
|
|
|
HBRUSH CPowerDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
|
|
{
|
|
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
|
|
|
|
// TODO: Change any attributes of the DC here
|
|
// TODO: Change any attributes of the DC here
|
|
if (pWnd == this)
|
|
{
|
|
return m_BgBrush;
|
|
}
|
|
else
|
|
// TODO: Return a different brush if the default is not desired
|
|
return hbr;
|
|
}
|
|
|
|
BOOL CPowerDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
CenterWindow(this); // center to the hpc screen
|
|
|
|
// TODO: Add extra initialization here
|
|
// 设置窗口大小
|
|
MoveWindow(0,0,320,240);
|
|
|
|
m_butExit.MoveWindow(282,6,25,25);
|
|
m_butExit.LoadBitmaps(IDB_SETVOLUME_CLOSE,IDB_SETVOLUME_CLOSED);
|
|
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
void CPowerDlg::OnPaint()
|
|
{
|
|
CPaintDC dc(this); // device context for painting
|
|
|
|
// TODO: Add your message handler code here
|
|
CFont titleFont;
|
|
// 18x18 粗体
|
|
titleFont.CreateFont(18,0,0,0,FW_BOLD,0,0,0,GB2312_CHARSET,OUT_DEFAULT_PRECIS,
|
|
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_SWISS,_T("Arial"));
|
|
dc.SelectObject(&titleFont);
|
|
|
|
|
|
COLORREF oldColor = dc.SetTextColor(RGB(0,0,0));
|
|
|
|
|
|
dc.SetBkMode(TRANSPARENT);
|
|
|
|
WCHAR strRes[MAX_PATH];
|
|
CString(LoadString(theApp.GetResourceLib(),IDS_SET_POWER_TITLE,strRes,MAX_PATH));
|
|
|
|
dc.DrawText(strRes,CRect(0,88,320,105),DT_CENTER|DT_VCENTER);
|
|
|
|
dc.SetTextColor(oldColor);
|
|
|
|
titleFont.DeleteObject();
|
|
|
|
// Do not call CDialog::OnPaint() for painting messages
|
|
}
|
|
|
|
void CPowerDlg::OnButtonPowerExit()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
EndDialog(1);
|
|
}
|