📄 winceskindlg.cpp
字号:
// WinCESkinDlg.cpp : implementation file
//
#include "stdafx.h"
#include "WinCESkin.h"
#include "WinCESkinDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CWinCESkinDlg dialog
CWinCESkinDlg::CWinCESkinDlg(CWnd* pParent /*=NULL*/)
: CDialog(CWinCESkinDlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CWinCESkinDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_EXIT, m_btnSkin);
DDX_Control(pDX, IDC_COPY, m_copySkin);
}
BEGIN_MESSAGE_MAP(CWinCESkinDlg, CDialog)
#if defined(_DEVICE_RESOLUTION_AWARE) && !defined(WIN32_PLATFORM_WFSP)
ON_WM_SIZE()
#endif
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDC_EXIT, &CWinCESkinDlg::OnBnClickedExit)
END_MESSAGE_MAP()
// CWinCESkinDlg message handlers
BOOL CWinCESkinDlg::OnInitDialog()
{
CDialog::OnInitDialog();
//---------------8.16-------------------------------------------
m_Menu.LoadMenu(IDR_MENU);
//m_Menu.SetImageLeft(IDB_BITMAP1);
//m_Menu.SetBackColor(RGB(192,0,0));
//m_Menu.SetImageLeft(IDB_BITMAP1);
//m_Menu.SetMenuDrawMode(1);
m_Menu.LoadToolBar(_T(IDR_TOOLBAR1),0);
SetMenu(&m_Menu);
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
//ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
//ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
//--------------------------------------------------------------
// 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
AddMenuToDlg(IDR_MENU);
// TODO: Add extra initialization here
m_btnSkin.SetSkin(IDC_EXIT);
m_copySkin.SetSkin(IDC_COPY);
//---------------------------------
CBitmap m_MenuBit2 , m_MenuBit3 , m_MenuBit4;
m_MenuBit2.LoadBitmap( IDI_ICON1 );
m_MenuBit3.LoadBitmap( IDI_ICON2 );
m_MenuBit4.LoadBitmap( IDI_ICON3 );
//---------------------------------
return TRUE; // return TRUE unless you set the focus to a control
}
#if defined(_DEVICE_RESOLUTION_AWARE) && !defined(WIN32_PLATFORM_WFSP)
void CWinCESkinDlg::OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/)
{
if (AfxIsDRAEnabled())
{
DRA::RelayoutDialog(
AfxGetResourceHandle(),
this->m_hWnd,
DRA::GetDisplayMode() != DRA::Portrait ?
MAKEINTRESOURCE(IDD_WINCESKIN_DIALOG_WIDE) :
MAKEINTRESOURCE(IDD_WINCESKIN_DIALOG));
}
}
#endif
void CWinCESkinDlg::OnBnClickedExit()
{
// TODO: Add your control notification handler code here
}
BOOL CWinCESkinDlg::AddMenuToDlg(WORD wMenuID)
{
HWND hwndCB;
hwndCB = CommandBar_Create(AfxGetInstanceHandle(), GetSafeHwnd(), IDR_MENU);
if (hwndCB != NULL)
{
CommandBar_InsertMenubar(hwndCB, AfxGetInstanceHandle(), wMenuID, IDR_MENU);
CommandBar_Show(hwndCB, TRUE);
}
else
{
return FALSE;
}
return TRUE;
}
void CWinCESkinDlg::OnInitMenu(CMenu* pMenu)
{
CWinCESkinDlg::OnInitMenu(pMenu);
//CWnd::OnInitMenu(pMenu);
//CDialog::OnInitMenu(pMenu);
//CMDIFrameWnd::OnInitMenu(pMenu);
//CBitmap m_MenuBit2 , m_MenuBit3 , m_MenuBit4;
// TODO: Add your message handler code here
//MENUITEMINFO info;
CMenu *pMe = this->GetMenu();
CMenu *pMyMenu = pMe->GetSubMenu(0);
HICON hIcon = AfxGetApp()->LoadIcon(IDI_ICON3);
pMyMenu->SetMenuItemInfo (IDI_ICON3,
(LPMENUITEMINFO)pMyMenu, FALSE);
}
//bm_open1.LoadBitmap(IDB_OPEN1);bm_open2.LoadBitmap(IDB_OPEN2);(
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -