表示用户用于在文档或应用程序中选择颜色的弹出菜单。
语法
class CMFCColorPopupMenu : public CMFCPopupMenu
成员
公共构造函数
| 名称 | 描述 |
|---|---|
| CMFCColorPopupMenu::CMFCColorPopupMenu | 构造 CMFCColorPopupMenu 对象。 |
CMFCColorPopupMenu::~CMFCColorPopupMenu |
析构函数。 |
公共方法
| 名称 | 描述 |
|---|---|
| CMFCColorPopupMenu::CreateTearOffBar | 创建可停靠的分离式颜色条。 (重写 CMFCPopupMenu::CreateTearOffBar。) |
| CMFCColorPopupMenu::GetMenuBar | 返回嵌入在弹出菜单中的 CMFCPopupMenuBar。 (重写 CMFCPopupMenu::GetMenuBar。) |
CMFCColorPopupMenu::GetThisClass |
由框架用于获取指向与此类类型关联的 CRuntimeClass 对象的指针。 |
| CMFCColorPopupMenu::SetPropList | 设置嵌入的 CMFCColorBar 对象的属性网格控件对象。 |
数据成员
| 名称 | 描述 |
|---|---|
m_bEnabledInCustomizeMode |
一个布尔值,该值确定是否显示颜色条。 |
m_wndColorBar |
提供 CMFCColorBar 颜色选择的对象。 |
备注
此类继承 CMFCPopupMenu 类的弹出菜单功能,并管理提供颜色选择的 CMFCColorBar 对象。 当工具栏框架处于自定义模式且 m_bEnabledInCustomizeMode 成员设置为 FALSE 时,不会显示颜色条对象。 有关自定义模式的详细信息,请参阅 CMFCToolBar::IsCustomizeMode
有关 CMFCColorBar 的详细信息,请参阅 CMFCColorBar 类。
继承层次结构
要求
标头:afxcolorpopupmenu.h
CMFCColorPopupMenu::CMFCColorPopupMenu
构造 CMFCColorPopupMenu 对象。
CMFCColorPopupMenu(
const CArray<COLORREF, COLORREF>& colors,
COLORREF color,
LPCTSTR lpszAutoColor,
LPCTSTR lpszOtherColor,
LPCTSTR lpszDocColors, CList<COLORREF, COLORREF>& lstDocColors,
int nColumns,
int nHorzDockRows,
int nVertDockColumns,
COLORREF colorAutomatic,
UINT uiCommandID,
BOOL bStdColorDlg = FALSE);
CMFCColorPopupMenu(
CMFCColorButton* pParentBtn,
const CArray<COLORREF, COLORREF>& colors,
COLORREF color,
LPCTSTR lpszAutoColor,
LPCTSTR lpszOtherColor,
LPCTSTR lpszDocColors, CList<COLORREF, COLORREF>& lstDocColors,
int nColumns,
COLORREF colorAutomatic);
CMFCColorPopupMenu(
CMFCRibbonColorButton* pParentBtn,
const CArray<COLORREF, COLORREF>& colors,
COLORREF color,
LPCTSTR lpszAutoColor,
LPCTSTR lpszOtherColor,
LPCTSTR lpszDocColors, CList<COLORREF, COLORREF>& lstDocColors,
int nColumns,
COLORREF colorAutomatic,
UINT nID);
参数
colors
[in] 框架在弹出菜单上显示的颜色数组。
color
[in] 默认选择的颜色。
lpszAutoColor
[in] 自动(默认)颜色按钮的文本标签或 NULL。
自动按钮的标准标签为“自动”。
lpszOtherColor
[in] 另一个按钮的文本标签(显示更多颜色选项)或 NULL。
另一个按钮的标准标签是“更多颜色…”。
lpszDocColors
[in] 文档颜色按钮的文本标签。 文档颜色调色板列出了文档当前使用的所有颜色。
lstDocColors
[in] 文档当前使用的颜色的列表。
nColumns
[in] 颜色数组具有的列数。
nHorzDockRows
[in] 颜色条在水平停靠时所包含的行数。
nVertDockColumns
[in] 颜色条在垂直停靠时所包含的列数。
colorAutomatic
[in] 单击自动按钮时框架应用的默认颜色。
uiCommandID
[in] 颜色条控件命令 ID。
bStdColorDlg
[in] 一个布尔值,该值指示是显示标准系统颜色对话框还是 CMFCColorDialog 对话框。
pParentBtn
[in] 指向父级按钮的指针。
nID
[in] 命令 ID。
备注
每个重载的构造函数都将 m_bEnabledInCustomizeMode 成员设置为 FALSE。
示例
以下示例演示如何构造 CMFCColorPopupMenu 对象。
COLORREF color;
CArray<COLORREF, COLORREF> colors;
CString strAutoColorText;
CString strOtherText;
CString strDocColorsText;
CList<COLORREF, COLORREF> lstDocColors;
COLORREF colorAutomatic;
int nColumns;
CMFCColorButton colorButton;
CMFCColorPopupMenu *pPopup = new CMFCColorPopupMenu(&colorButton, colors, color, strAutoColorText, strOtherText, strDocColorsText, lstDocColors, nColumns, colorAutomatic);
CMFCColorPopupMenu::CreateTearOffBar
创建可停靠的分离式颜色条。
virtual CPane* CreateTearOffBar(
CFrameWnd* pWndMain,
UINT uiID,
LPCTSTR lpszName);
参数
pWndMain
[in] 指向分离式条的父窗口的指针。
uiID
[in] 分离式条的命令 ID。
lpszName
[in] 分离式条的窗口文本。
返回值
指向新的分离式控件条对象的指针。
备注
此方法创建 CMFCColorBar 类对象并将其强制转换为 CPane 类指针。 可通过使用 MFC 类对象的类型强制转换中所述的强制转换宏之一,将此值强制转换回 CMFCColorBar 类。
CMFCColorPopupMenu::GetMenuBar
返回嵌入在弹出菜单中的 CMFCPopupMenuBar。
virtual CMFCPopupMenuBar* GetMenuBar();
返回值
指向嵌入的 CMFCPopupMenuBar 的指针。
备注
颜色弹出菜单具有嵌入的 CMFCPopupMenuBar 类对象。 如果应用程序使用不同的嵌入类型,请在派生类中重写此方法。
CMFCColorPopupMenu::SetPropList
设置嵌入的 CMFCColorBar 对象的属性网格控件对象。
void SetPropList(CMFCPropertyGridCtrl* pWndList);
参数
pWndList
[in] 指向属性网格控件对象的指针。