// This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface
// (the "Fluent UI") and is provided only as referential material to supplement the
// Microsoft Foundation Classes Reference and related electronic documentation
// included with the MFC C++ library software.
// License terms to copy, use or distribute the Fluent UI are available separately.
// To learn more about our Fluent UI licensing program, please visit
// http://msdn.microsoft.com/officeui.
//
// Copyright (C) Microsoft Corporation
// All rights reserved.
#include "stdafx.h"
#include "MSOffice2007Demo.h"
#include "OptionsPage.h"
#include "ResourcePage.h"
#include "MainFrm.h"
#include "keys.h"
#include "RibbonTableButton.h"
#include <memory>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#pragma warning(disable:4100)
const int IdStartProgressTimer = 1;
const int IdShowProgressTimer = 2;
const DWORD idTabDeveloper = 101;
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWndEx)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWndEx)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_WM_GETMINMAXINFO()
ON_WM_PAINT()
ON_WM_ERASEBKGND()
ON_WM_SIZING()
ON_WM_SIZE()
ON_WM_TIMER()
ON_COMMAND(ID_WRITE_CLIPBOARD, OnWriteClipboard)
ON_UPDATE_COMMAND_UI(ID_WRITE_CLIPBOARD, OnUpdateWriteClipboard)
ON_COMMAND(ID_VIEW_RTL, OnViewRtl)
ON_UPDATE_COMMAND_UI(ID_VIEW_RTL, OnUpdateViewRtl)
ON_COMMAND(ID_STATUSBAR_ZOOM_SLIDER, OnZoomSlider)
ON_COMMAND(ID_STATUSBAR_ZOOM, OnZoom)
ON_COMMAND_RANGE(ID_VIEW_APPLOOK_2003, ID_VIEW_APPLOOK_WIN7, OnAppLook)
ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_APPLOOK_2003, ID_VIEW_APPLOOK_WIN7, OnUpdateAppLook)
ON_COMMAND(ID_STATUSBAR_REFRESH, OnRefresh)
ON_UPDATE_COMMAND_UI(ID_STATUSBAR_REFRESH, OnUpdateRefresh)
ON_COMMAND(ID_STATUSBAR_SPELL, OnSpell)
ON_COMMAND(ID_TOOLS_OPTIONS, OnToolsOptions)
ON_REGISTERED_MESSAGE(AFX_WM_ON_RIBBON_CUSTOMIZE, OnRibbonCustomize)
ON_COMMAND(ID_STATUSBAR_LINK, OnLink)
ON_REGISTERED_MESSAGE(AFX_WM_ON_HIGHLIGHT_RIBBON_LIST_ITEM, OnHighlightRibbonListItem)
ON_COMMAND(ID_VIEW_MESSAGEBAR, OnViewMessageBar)
ON_UPDATE_COMMAND_UI(ID_VIEW_MESSAGEBAR, OnUpdateViewMessageBar)
ON_REGISTERED_MESSAGE(AFX_WM_ON_BEFORE_SHOW_RIBBON_ITEM_MENU, OnShowRibbonItemMenu)
ON_COMMAND_RANGE(ID_PAGELAYOUT_EFFECTS_ACADEMIC, ID_PAGELAYOUT_THEMES_MORETHEMES, OnDummy)
ON_COMMAND(ID_FILE_PRINT, OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, OnFilePrintPreview)
ON_UPDATE_COMMAND_UI(ID_FILE_PRINT_PREVIEW, OnUpdateFilePrintPreview)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//////////////////////////////////////////////////////////////////////////
// CMFCRibbonNumEditCtrl
class CMFCRibbonNumEditCtrl : public CMFCRibbonRichEditCtrl
{
protected:
int m_nValidNum;
DECLARE_MESSAGE_MAP()
public:
CMFCRibbonNumEditCtrl::CMFCRibbonNumEditCtrl(CMFCRibbonEdit& edit) : CMFCRibbonRichEditCtrl(edit)
{
m_nValidNum = 0;
}
virtual void OnKillFocus(CWnd* pNewWnd)
{
CMFCRibbonRichEditCtrl::OnKillFocus(pNewWnd);
int nTempVal = _ttoi(m_strOldText);
if (nTempVal != 0)
{
m_nValidNum = nTempVal;
}
else
{
m_strOldText.Empty();
m_nValidNum = 0;
}
CString strText;
strText.Format(_T("%d"), m_nValidNum);
m_edit.SetEditText(strText);
}
};
BEGIN_MESSAGE_MAP(CMFCRibbonNumEditCtrl, CMFCRibbonRichEditCtrl)
ON_WM_KILLFOCUS()
END_MESSAGE_MAP()
//////////////////////////////////////////////////////////////////////////
// CMFCRibbonNumEdit
class CMFCRibbonNumEdit : public CMFCRibbonEdit
{
public:
CMFCRibbonNumEdit::CMFCRibbonNumEdit(UINT uiID, int nWidth, LPCTSTR lpszLabel, int nImage = -1)
: CMFCRibbonEdit(uiID, nWidth, lpszLabel, nImage)
{
}
virtual ~CMFCRibbonNumEdit() {}
virtual CMFCRibbonRichEditCtrl* CreateEdit(CWnd* pWndParent, DWORD dwEditStyle)
{
ASSERT_VALID(this);
ASSERT_VALID(pWndParent);
CMFCRibbonNumEditCtrl* pWndEdit = new CMFCRibbonNumEditCtrl(*this);
if (!pWndEdit->Create(dwEditStyle, CRect(0, 0, 0, 0), pWndParent, m_nID))
{
delete pWndEdit;
return NULL;
}
if (m_bHasSpinButtons)
{
CreateSpinButton(pWndEdit, pWndParent);
}
return pWndEdit;
}
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame() : m_wndRibbonBar(TRUE)
{
m_rectFill.SetRectEmpty();
m_rectSizing.SetRectEmpty();
m_nProgressValue = -1;
m_bInfiniteProgressMode = TRUE;
CreateDocumentColors();
CreateStyleList();
CreateThemeList();
CreateFontsList();
CMFCPopupMenu::SetAnimationType(CMFCPopupMenu::SYSTEM_DEFAULT_ANIMATION);
}
CMainFrame::~CMainFrame()
{
for (POSITION pos = m_TooltipImages.GetStartPosition(); pos != NULL;)
{
CMFCToolBarImages* pBmp = NULL;
UINT uiID;
m_TooltipImages.GetNextAssoc(pos, uiID, pBmp);
delete pBmp;
}
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWndEx::OnCreate(lpCreateStruct) == -1)
return -1;
// Load background patterns:
m_Pat[0].Create(CMFCControlRendererInfo(IDB_VIEWPAT_1, RGB(255, 0, 255), CRect(0, 0, 8, 8), CRect(0, 0, 0, 0)));
m_Pat[1].Create(CMFCControlRendererInfo(IDB_VIEWPAT_2, RGB(255, 255, 255), CRect(0, 0, 499, 157), CRect(0, 0, 0, 0), CRect(480, 0, 0, 0), CRect(480, 0, 499, 157)));
m_Pat[2].Create(CMFCControlRendererInfo(IDB_VIEWPAT_3, RGB(255, 255, 255), CRect(0, 0, 499, 157), CRect(0, 0, 0, 0), CRect(480, 0, 0, 0), CRect(480, 0, 499, 157)));
m_Pat[3].Create(CMFCControlRendererInfo(IDB_VIEWPAT_4, RGB(255, 255, 255), CRect(0, 0, 499, 157), CRect(0, 0, 0, 0), CRect(480, 0, 0, 0), CRect(480, 0, 499, 157)));
if (!CreateRibbonBar())
{
TRACE0("Failed to create ribbon bar\n");
return -1; // fail to create
};
if (!CreateStatusBar())
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
if (!CreateMessageBar())
{
TRACE0("Failed to create message bar\n");
}
// Create task pane:
CRect rectDummy(0, 0, 200, 400);
if (!m_wndTaskPane.Create(_T("Clipboard"), this, rectDummy, TRUE, ID_VIEW_TASK_PANE, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | AFX_CBRS_CLOSE | AFX_CBRS_FLOAT))
{
TRACE0("Failed to create task pane\n");
return -1;
}
m_wndTaskPane.EnableDocking(CBRS_ALIGN_RIGHT | CBRS_ALIGN_LEFT);
DockPane(&m_wndTaskPane);
EnableDocking(CBRS_ALIGN_ANY);
OnChangeLayout();
// Show progress bar after the short delay:
SetTimer(IdStartProgressTimer, 500, NULL);
// Start animation:
CMFCRibbonStatusBarPane* pPane = DYNAMIC_DOWNCAST(CMFCRibbonStatusBarPane, m_wndStatusBar.FindElement(ID_STATUSBAR_SPELL));
if (pPane != NULL)
{
pPane->StartAnimation(500 /* Frame delay*/, 5000 /* Duration */);
}
return 0;
}
void CMainFrame::SetKeys()
{
//m_MainButton.SetKeys(_T("fa"));
m_wndRibbonBar.SetElementKeys(ID_MAIN_BUTTON, _T("fa"), _T("fa"));
for (int i = 0; keys [i].uiCmd != 0; i++)
{
CString str = keys [i].lpszKey;
int nAmpIndex = str.Find(_T('&'));
if (nAmpIndex >= 0)
{
CString str1 = str.Left(nAmpIndex);
CString str2 = str.Mid(nAmpIndex + 1);
m_wndRibbonBar.SetElementKeys(keys [i].uiCmd, str1, str2);
}
else
{
m_wndRibbonBar.SetElementKeys(keys [i].uiCmd, str);
}
}
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if ( !CFrameWndEx::PreCreateWindow(cs) )
return FALSE;
cs.style |= WS_CLIPCHILDREN;
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWndEx::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameW
没有合适的资源?快使用搜索试试~ 我知道了~
MFC sp1学习示例
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共1557个文件
h:410个
cpp:334个
bmp:316个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
![star](https://csdnimg.cn/release/downloadcmsfe/public/img/star.98a08eaa.png)
温馨提示
这是MFC SP1提供的学习例子,在VS2010的安装目录下有,我把它改成2008工程而已
资源推荐
资源详情
资源评论
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![thumb](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
共 1557 条
- 1
- 2
- 3
- 4
- 5
- 6
- 16
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
- macrocan2013-03-31很全面,不过想要的是一份学习例程
- xiaoyu_code2012-09-13很全面,fluent ui的例子很详细,不错...
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
qiudaowen
- 粉丝: 3
- 资源: 9
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)