CMFCRibbonApplicationButton 类

实现位于应用程序窗口左上角的特殊按钮。 单击此按钮将打开一个菜单,其中通常包含公共的 “文件” 命令,如 “打开”“保存”“退出”

语法

class CMFCRibbonApplicationButton : public CMFCRibbonButton

成员

公共构造函数

名称 描述
CMFCRibbonApplicationButton::CMFCRibbonApplicationButton 构造并初始化一个 CMFCRibbonApplicationButton 对象。

公共方法

名称 描述
CMFCRibbonApplicationButton::CreateObject 由框架用于创建此类类型的动态实例。
CMFCRibbonApplicationButton::GetThisClass 由框架用于获取指向与此类类型关联的 CRuntimeClass 对象的指针。
CMFCRibbonApplicationButton::SetImage 将图像分配给功能区应用程序按钮。

示例

下面的示例演示了如何使用 CMFCRibbonApplicationButton 类中的各种方法。 该示例显示如何将图像分配给应用程序按钮,以及如何设置其工具提示。 此代码片段属于 Draw Client 示例

CMFCRibbonApplicationButton m_MainButton;
m_MainButton.SetImage(IDB_RIBBON_MAIN);
m_MainButton.SetToolTipText(_T("File"));
// Set the short cut keyboard text.
m_MainButton.SetText(_T("f"));

继承层次结构

CObject

CMFCRibbonBaseElement

CMFCRibbonButton

CMFCRibbonApplicationButton

要求

标头:afxRibbonBar.h

CMFCRibbonApplicationButton::CMFCRibbonApplicationButton

构造并初始化 CMFCRibbonApplicationButton 对象。

CMFCRibbonApplicationButton();
CMFCRibbonApplicationButton(UINT uiBmpResID);
CMFCRibbonApplicationButton(HBITMAP hBmp);

参数

uiBmpResID
要显示在应用程序按钮上的图像的资源 ID。

hBmp
要显示在应用程序按钮上的位图的句柄。

备注

功能区应用程序按钮是一个特殊按钮,位于应用程序窗口的左上角。 当用户单击此按钮时,应用程序会打开一个菜单,该菜单通常包含常见的“文件”命令,例如“打开”、“保存”和“退出”

CMFCRibbonApplicationButton::SetImage

将图像分配给应用程序按钮。

void SetImage(UINT uiBmpResID);
void SetImage(HBITMAP hBmp);

参数

uiBmpResID
[in] 要在应用程序按钮上显示的图像的资源 ID。

hBmp
[in] 要在应用程序按钮上显示的位图句柄。

注解

创建按钮后,使用此方法将新图像分配给功能区应用程序按钮。 应用程序按钮位于应用程序窗口的左上角。

另请参阅

层次结构图

CMFCRibbonButton 类