MFC Ribbon如何加图标,我已经做好图标序列并且导入。当时Image Collection(图像集合)里没有图标序列

MFC Ribbon如何加图标,我已经做好图标序列并且导入。当时Image Collection(图像集合)里没有图标序列,第1张

导入资源,或者不要使用序列,使用单个图标也行;

如:m_pPenStyleButton = new CHHTMFCRibbonButton(ID_PEN_STYLE, _T(""), AfxGetApp()->LoadIcon(IDI_ICON_PENSTYLE))IDI_ICON_PENSTYLE就是图标资源,不过这里图标是ICO格式的;

本文分步介绍了如何在应用程序中添加BCGControlBar的Ribbon控件,并且附源码。

1、打开MainFrme.h,移除CBCGPMenuBar、 m_wndMenuBar、CBCGPToolBar、 m_wndToolBar。

2、对Ribbon Bar和主要的 Ribbon Button添加自定义。

1

2

CBCGPRibbonBar m_wndRibbonBar

CBCGPRibbonMainButton m_MainButton

3、添加定义面板图像列表。

1

CBCGPToolBarImages m_PanelIcons

4、打开MainFrm.cpp,移除m_wndMenuBar 和m_wndToolBar有关的东西。

5、对源添加一个Ribbon Main Button(IDB_MAIN)26X26像素的位图,小图标(16像素高度)的位图列表以及大图标(32像素高度)位图列表,并将他们命名为IDB_SMALL_ICONS和IDB_LARGE_ICONS respectively。

6、在CMainFrame::OnCreate中创建Ribbon Bar:

1

m_wndRibbonBar.Create (this)

7、初始化和设置主要的Ribbon Button:

1

2

3

4

m_MainButton.SetMenu (IDR_FILE_MENU)

m_MainButton.SetImage (IDB_MAIN)

m_MainButton.SetToolTipText (_T("File"))

m_wndRibbonBar.SetMainButton (&m_MainButton, CSize (45, 45))

8、初始化和加载面板图标的图像列表。

1

2

m_PanelIcons.SetImageSize (CSize (16, 16))

m_PanelIcons.Load (IDB_PANEL_ICONS)

9、添加第一类:

1

2

3

4

CBCGPRibbonCategory* pCategory = m_wndRibbonBar.AddCategory

(_T("&Write"), // Category name

IDB_WRITE, // Category small images (16 x 16)

IDB_WRITE_LARGE) // Category large images (32 x 32)

10、添加第一个面板到这个类别:

1

2

3

CBCGPRibbonPanel* pPanel = pCategory->AddPanel (

_T("Clipboard"), // Panel name

m_PanelIcons.ExtractIcon (0)) // Panel icon

11、添加ribbon元素到面板:

1

2

3

4

5

6

7

8

9

10

11

12

// Create the first button to Panel ("Paste"):

CBCGPRibbonButton* pPasteButton = new CBCGPRibbonButton (ID_EDIT_PASTE, _T("Paste"), -1, 0)

// The third parameter (-1) tells that this button does not have a small icon.

// Therefore the "Paste" button will be always displayed with large icon.

// Associate a popup menu with the "Paste" button:

pPasteButton->SetMenu (IDR_CONTEXT_MENU)

// Add other buttons to the panel. These buttons have small icons only:

pPanel->Add (new CBCGPRibbonButton (ID_EDIT_CUT, _T("Cut"), 1))

pPanel->Add (new CBCGPRibbonButton (ID_EDIT_COPY, _T("Copy"), 2))

pPanel->Add (new CBCGPRibbonButton (ID_EDIT_PAINT, _T("Paint"), 9))

第1步,打开Word2010文档窗口,在“开始”功能区的“编辑”分组中依次单击“查找”→“高级查找”按钮,如图2010081204所示。图2010081204 单击“高级查找”按钮

第2步,在打开的“查找和替换”对话框中单击“更多”按钮打开“查找和替换”对话框的扩展面板,在扩展面板中可以看到更多查找选项,如图2010081205所示。图2010081205 更多查找选项

小提示:“查找和替换”对话框“更多”扩展面板选项的含义如下所述:

l 搜索:在“搜索”下拉菜单中可以选择“向下”、“向上”和“全部”选项选择查找的开始位置;

l 区分大小写:查找与目标内容的英文字母大小写完全一致的字符;

l 全字匹配:查找与目标内容的拼写完全一致的字符或字符组合;

l 使用通配符:允许使用通配符(例如^#、^?等)查找内容;

l 同音(英文):查找与目标内容发音相同的单词;


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/bake/11458853.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-16
下一篇2023-05-16

发表评论

登录后才能评论

评论列表(0条)

    保存