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

📄 cegenericmfcdlg.cpp

📁 WinCE下的一个图形按钮例子
💻 CPP
字号:
#include "stdafx.h"
#include "CeGenericMFC.h"
#include "CeGenericMFCDlg.h"

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

#define IDS_WEBADDR		_T("http://www.softechsoftware.it")
#define IDS_MAILADDR	_T("mailto:davide_calabro@yahoo.com")

CCeGenericMFCDlg::CCeGenericMFCDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CCeGenericMFCDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCeGenericMFCDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CCeGenericMFCDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCeGenericMFCDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP

	DDX_Control(pDX, IDC_HOMEPAGELINK, m_btnWeb);
	DDX_Control(pDX, IDC_EMAILLINK, m_btnMail);

	DDX_Control(pDX, IDC_BTNSHADE1, m_btnButtons[0]);
	DDX_Control(pDX, IDC_BTNSHADE2, m_btnButtons[1]);
	DDX_Control(pDX, IDC_BTNSHADE3, m_btnButtons[2]);
	DDX_Control(pDX, IDC_BTNSHADE4, m_btnButtons[3]);
	DDX_Control(pDX, IDC_BTNSHADE5, m_btnButtons[4]);
	DDX_Control(pDX, IDC_BTNSHADE6, m_btnButtons[5]);
	DDX_Control(pDX, IDC_BTNSHADE7, m_btnButtons[6]);
	DDX_Control(pDX, IDC_BTNSHADE8, m_btnButtons[7]);
}

BEGIN_MESSAGE_MAP(CCeGenericMFCDlg, CDialog)
	//{{AFX_MSG_MAP(CCeGenericMFCDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BOOL CCeGenericMFCDlg::OnInitDialog()
{
	COLORREF	crBtnColor;

	CDialog::OnInitDialog();

	// Calculate a color effect for hilighting the button
	crBtnColor = ::GetSysColor(COLOR_BTNFACE) + RGB(30, 30, 30);

	SetIcon(m_hIcon, TRUE);
	SetIcon(m_hIcon, FALSE);
	
	CenterWindow(GetDesktopWindow());

	// Buttons
	m_btnWeb.SetFont(GetFont());
	m_btnWeb.SetIcon(IDI_WEB, CSize(16,16));
	m_btnWeb.SetColor(CCeButtonST::BTNST_COLOR_BK_IN, crBtnColor, FALSE);
	//m_btnWeb.SetBtnCursor(IDC_HAND1, FALSE);
	m_btnWeb.SetURL(IDS_WEBADDR);
	//
	m_btnMail.SetFont(GetFont());
	m_btnMail.SetIcon(IDI_MAIL, CSize(16,16));
	m_btnMail.SetColor(CCeButtonST::BTNST_COLOR_BK_IN, crBtnColor, FALSE);
	m_btnMail.SetURL(IDS_MAILADDR);

	m_btnButtons[0].SetFont(GetFont());
	m_btnButtons[0].SetShade(CShadeButtonST::SHS_METAL);
	m_btnButtons[0].SetIcon(IDI_RAZOR);
	//
	m_btnButtons[1].SetFont(GetFont());
	m_btnButtons[1].SetShade(CShadeButtonST::SHS_HARDBUMP);
	m_btnButtons[1].SetIcon(IDI_HELP);
	m_btnButtons[1].SetAlign(CCeButtonST::ST_ALIGN_VERT);
	//
	m_btnButtons[2].SetFont(GetFont());
	m_btnButtons[2].SetShade(CShadeButtonST::SHS_SOFTBUMP);
	m_btnButtons[2].SetIcon(IDI_SEARCH1, CSize(32, 32), IDI_SEARCH2, CSize(32, 32));
	//
	m_btnButtons[3].SetFont(GetFont());
	m_btnButtons[3].SetShade(CShadeButtonST::SHS_NOISE, 33);
	m_btnButtons[3].SetIcon(IDI_OK3);
	m_btnButtons[3].SetAlign(CCeButtonST::ST_ALIGN_VERT);
	//
	m_btnButtons[4].SetFont(GetFont());
	m_btnButtons[4].SetShade(CShadeButtonST::SHS_VBUMP,8,20,5,RGB(55,55,255));
	m_btnButtons[4].SetIcon(IDI_HELP2);
	//
	m_btnButtons[5].SetFont(GetFont());
	m_btnButtons[5].SetShade(CShadeButtonST::SHS_HBUMP,8,20,5,RGB(55,55,255));
	m_btnButtons[5].SetIcon(IDI_WEB2);
	//
	m_btnButtons[6].SetFont(GetFont());
	m_btnButtons[6].SetShade(CShadeButtonST::SHS_VSHADE,8,20,5,RGB(55,55,255));
	m_btnButtons[6].SetIcon(IDI_CANCEL3);
	m_btnButtons[6].SetAlign(CCeButtonST::ST_ALIGN_HORIZ_RIGHT);
	//
	m_btnButtons[7].SetFont(GetFont());
	m_btnButtons[7].SetShade(CShadeButtonST::SHS_DIAGSHADE,8,10,5,RGB(55,255,55));
	m_btnButtons[7].SetIcon(IDI_RUN);
	m_btnButtons[7].SetColor(CCeButtonST::BTNST_COLOR_FG_IN, RGB(0, 178, 0));
	m_btnButtons[7].SetColor(CCeButtonST::BTNST_COLOR_FG_OUT, RGB(0, 128, 0));

	return TRUE;
} // End of OnInitDialog

⌨️ 快捷键说明

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