共用方式為


CMFCPropertyGridColorProperty 類別

CMFCPropertyGridColorProperty 類別支援開啟色彩選取對話方塊的屬性清單控制項項目。

語法

class CMFCPropertyGridColorProperty : public CMFCPropertyGridProperty

成員

公用建構函式

名稱 描述
CMFCPropertyGridColorProperty::CMFCPropertyGridColorProperty 建構 CMFCPropertyGridColorProperty 物件。
CMFCPropertyGridColorProperty::~CMFCPropertyGridColorProperty 解構函式。

公用方法

名稱 描述
CMFCPropertyGridColorProperty::EnableAutomaticButton 啟用色彩選取對話方塊上的自動 按鈕。 (標準自動按鈕已加上卷 標Automatic .)
CMFCPropertyGridColorProperty::EnableOtherButton 啟用色彩選取對話方塊上的其他 按鈕。 (標準其他按鈕已加上標籤 更多色彩
CMFCPropertyGridColorProperty::FormatProperty 格式化屬性值的文字表示法。 (覆寫 CMFCPropertyGridProperty::FormatProperty .)
CMFCPropertyGridColorProperty::GetColor 取得屬性的目前色彩。
CMFCPropertyGridColorProperty::GetThisClass 由架構用來取得與這個類別類型相關聯之 CRuntimeClass 物件的指標。
CMFCPropertyGridColorProperty::OnClickButton 使用者按一下屬性中內含的按鈕時由架構呼叫。 (覆寫 CMFCPropertyGridProperty::OnClickButton .)
CMFCPropertyGridColorProperty::OnDrawValue 由架構呼叫以顯示屬性值。 (覆寫 CMFCPropertyGridProperty::OnDrawValue .)
CMFCPropertyGridColorProperty::OnEdit 使用者即將修改屬性值時由架構呼叫。 (覆寫 CMFCPropertyGridProperty::OnEdit .)
CMFCPropertyGridColorProperty::OnUpdateValue 當可編輯屬性的值變更時由架構呼叫。 (覆寫 CMFCPropertyGridProperty::OnUpdateValue .)
CMFCPropertyGridColorProperty::SetColor 設定屬性的新色彩。
CMFCPropertyGridColorProperty::SetColumnsNumber 指定目前色彩屬性格線中的資料行數目。
CMFCPropertyGridColorProperty::SetOriginalValue 設定可編輯屬性的原始值。

備註

CMFCPropertyGridColorProperty 類別支援的色彩屬性可以加入至屬性清單控制項。 如需詳細資訊,請參閱 CMFCPropertyGridCtrl 類別

範例

下列範例示範如何建構 CMFCPropertyGridColorProperty 類別的物件,以及使用 CMFCPropertyGridColorProperty 類別的各種方法來設定此物件。 程式碼說明如何啟用自動和其他按鈕,以及如何設定色彩和資料行數目。 此範例是 New Controls 範例 一部分。

CMFCPropertyGridColorProperty *pColorProp = new CMFCPropertyGridColorProperty(_T("Window Color"), RGB(210, 192, 254), NULL, _T("Specifies the default dialog color"));
pColorProp->EnableOtherButton(_T("Other..."));
pColorProp->EnableAutomaticButton(_T("Default"), ::GetSysColor(COLOR_3DFACE));
pColorProp->SetColor(RGB(255, 0, 0));
pColorProp->SetColumnsNumber(3);

繼承階層架構

CObject

CMFCPropertyGridProperty

CMFCPropertyGridColorProperty

需求

標頭: afxpropertygridctrl.h

CMFCPropertyGridColorProperty::CMFCPropertyGridColorProperty

建構 CMFCPropertyGridColorProperty 物件。

CMFCPropertyGridColorProperty(
    const CString& strName,
    const COLORREF& color,
    CPalette* pPalette = NULL,
    LPCTSTR lpszDescr = NULL,
    DWORD_PTR dwData = 0);

參數

strName
[in]屬性的名稱。

color
[in]屬性的色彩值。

pPalette
[in]色彩調色盤的指標。 預設值是 NULL。

lpszDescr
[in]屬性描述。 預設值是 NULL。

dwData
[in]應用程式特定的資料,例如整數或與 屬性相關聯的其他資料的指標。 預設值是 0。

CMFCPropertyGridColorProperty::EnableAutomaticButton

啟用色彩選取對話方塊上的自動 按鈕。 (標準自動按鈕已加上卷 標Automatic .)

void EnableAutomaticButton(
    LPCTSTR lpszLabel,
    COLORREF colorAutomatic,
    BOOL bEnable=TRUE);

參數

lpszLabel
[in]自動按鈕的標籤文字。

colorAutomatic
[in]自動 (預設) 色彩的 RGB 色彩值。

bEnable
[in]TRUE 表示啟用自動按鈕;否則為 FALSE。 預設值為 TRUE。

備註

CMFCPropertyGridColorProperty::EnableOtherButton

啟用色彩選取對話方塊上的其他 按鈕。 (標準其他按鈕已加上標籤 更多色彩

void EnableOtherButton(
    LPCTSTR lpszLabel,
    BOOL bAltColorDlg = TRUE,
    BOOL bEnable = TRUE);

參數

lpszLabel
[in]另一個按鈕的標籤文字。

bAltColorDlg
[in]TRUE 可顯示 CMFCColorDialog 對話方塊;FALSE 表示顯示標準色彩選取對話方塊。 預設值為 TRUE。

bEnable
[in]TRUE 可顯示另一個按鈕;否則為 FALSE。 預設值為 TRUE。

備註

CMFCPropertyGridColorProperty::GetColor

取得屬性的目前色彩。

COLORREF GetColor() const;

傳回值

RGB 色彩值。

備註

CMFCPropertyGridColorProperty::SetColor

設定屬性的新色彩。

void SetColor(COLORREF color);

參數

color
[in]RGB 色彩值。

備註

CMFCPropertyGridColorProperty::SetColumnsNumber

指定目前色彩屬性格線中的資料行數目。

void SetColumnsNumber(int nColumnsNumber);

參數

nColumnsNumber
[in]色彩屬性方格中慣用的資料行數目。

備註

這個方法會設定受保護資料成員的值 m_nColumnsNumber

CMFCPropertyGridColorProperty::SetOriginalValue

設定可編輯屬性的原始值。

virtual void SetOriginalValue(const COleVariant& varValue);

參數

varValue
[in]值。

備註

使用 CMFCPropertyGridProperty::ResetOriginalValue 方法來重設編輯屬性的原始值。

另請參閱

階層架構圖表
類別
CMFCPropertyGridCtrl 類別
CMFCPropertyGridProperty 類別