⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hmiexitdlg.cpp

📁 面板显示程序
💻 CPP
字号:
// HMIexitDlg.cpp : implementation file
//

#include "stdafx.h"
#include "HMIcan_usb.h"
#include "HMIexitDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CHMIexitDlg dialog


CHMIexitDlg::CHMIexitDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CHMIexitDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CHMIexitDlg)
	//}}AFX_DATA_INIT
}


void CHMIexitDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CHMIexitDlg)
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CHMIexitDlg, CDialog)
	//{{AFX_MSG_MAP(CHMIexitDlg)
	ON_WM_CTLCOLOR()
	ON_WM_DESTROY()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CHMIexitDlg message handlers

BOOL CHMIexitDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	//对话框背景
	m_bmpBg.LoadBitmap(IDB_BITMAP_exit);
	m_brBk.CreatePatternBrush(&m_bmpBg);
	m_bmpBg.DeleteObject();

	//创建位图按钮
	m_BitmapBtn_Yes.Create(NULL,WS_CHILD|WS_VISIBLE|BS_OWNERDRAW,CRect(35,56,75,76),this,20);
	m_BitmapBtn_No.Create(NULL,WS_CHILD|WS_VISIBLE|BS_OWNERDRAW,CRect(75,56,105,76),this,21);
	m_BitmapBtn_Yes.LoadBitmaps(IDB_BITMAP_yes_);
	m_BitmapBtn_No.LoadBitmaps(IDB_BITMAP_No);


	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

HBRUSH CHMIexitDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	
	// TODO: Change any attributes of the DC here
	if (pWnd == this)
	{
		return m_brBk;
	}	
	// TODO: Return a different brush if the default is not desired
	return hbr;
}

void CHMIexitDlg::OnDestroy() 
{
	CDialog::OnDestroy();
	
	// TODO: Add your message handler code here
	
}

BOOL CHMIexitDlg::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	if(CHMIexitDlg::GetFocus() == GetDlgItem(20))
	{
		m_BitmapBtn_Yes.LoadBitmaps(IDB_BITMAP_yes_);
		m_BitmapBtn_No.LoadBitmaps(IDB_BITMAP_No);				
		m_BitmapBtn_Yes.RedrawWindow();
		m_BitmapBtn_No.RedrawWindow();	
	}
	else
	{
		m_BitmapBtn_Yes.LoadBitmaps(IDB_BITMAP_yes);
		m_BitmapBtn_No.LoadBitmaps(IDB_BITMAP_No_);
		m_BitmapBtn_Yes.RedrawWindow();
		m_BitmapBtn_No.RedrawWindow();
	}

//响应回车键
	if(pMsg->message==WM_KEYDOWN && (pMsg->wParam==VK_RETURN))
	{
		if(CHMIexitDlg::GetFocus() == GetDlgItem(20))
		{
			HMIcan_usbDlg->OnDestroy();
			CDialog::OnDestroy();
			delete this;
			return   TRUE;
		}
		else
		{

		}
	}
	return CDialog::PreTranslateMessage(pMsg);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -