Muokkaa

Jaa


CMFCPropertyGridFontProperty Class

The CMFCPropertyGridFileProperty class supports a property list control item that opens a font selection dialog box.

Syntax

class CMFCPropertyGridFontProperty : public CMFCPropertyGridProperty

Members

Public Constructors

Name Description
CMFCPropertyGridFontProperty::CMFCPropertyGridFontProperty Constructs a CMFCPropertyGridFontProperty object.
CMFCPropertyGridFontProperty::~CMFCPropertyGridFontProperty Destructor.

Public Methods

Name Description
CMFCPropertyGridFontProperty::FormatProperty Formats the text representation of a property value. (Overrides CMFCPropertyGridProperty::FormatProperty.)
CMFCPropertyGridFontProperty::GetColor Retrieves the font color that the user selects from the font dialog box.
CMFCPropertyGridFontProperty::GetLogFont Retrieves the font that the user selects from the font dialog box.
CMFCPropertyGridFontProperty::GetThisClass Used by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type.
CMFCPropertyGridFontProperty::OnClickButton Called by the framework when the user clicks a button that is contained in a property. (Overrides CMFCPropertyGridProperty::OnClickButton.)

Remarks

Inheritance Hierarchy

CObject

CMFCPropertyGridProperty

CMFCPropertyGridFontProperty

Requirements

Header: afxpropertygridctrl.h

CMFCPropertyGridFontProperty::CMFCPropertyGridFontProperty

Constructs a CMFCPropertyGridFontProperty object.

CMFCPropertyGridFontProperty(
    const CString& strName,
    LOGFONT& lf,
    DWORD dwFontDialogFlags = CF_EFFECTS | CF_SCREENFONTS,
    LPCTSTR lpszDescr = NULL,
    DWORD_PTR dwData = 0,
    COLORREF color = (COLORREF)-1);

Parameters

strName
[in] The name of the property.

lf
[in] A logical font structure that specifies the attributes of the font.

dwFontDialogFlags
[in] Styles that are applied to the font dialog box that is displayed when you click the property value drop-down button. The default value is the bitwise combination (OR) of CF_EFFECTS and CF_SCREENFONTS. For more information, see the Flags parameter of the CHOOSEFONT Structure.

lpszDescr
[in] Description of the font property. The default value is NULL.

dwData
[in] Application-specific data, such as an integer or a pointer to other data that is associated with the property. The default value is 0.

color
[in] The color of the font. The default value is the default color.

Remarks

A CMFCPropertyGridFontProperty object represents a font property in a property grid font control.

Example

The following example demonstrates how construct an object of the CMFCPropertyGridFontProperty class. This example is part of the New Controls sample.

// LOGFONT lf
// CMFCPropertyGridProperty* pGroupFont
pGroupFont->AddSubItem(new CMFCPropertyGridFontProperty(_T("Font"), lf, CF_EFFECTS | CF_SCREENFONTS, _T("Specifies the default font for the dialog")));

CMFCPropertyGridFontProperty::GetColor

Retrieves the font color that the user selects from the font dialog box.

COLORREF GetColor() const;

Return Value

An RGB color value that represents the selected font color.

Remarks

CMFCPropertyGridFontProperty::GetLogFont

Retrieves the font that the user selects from the font dialog box.

LPLOGFONT GetLogFont();

Return Value

A pointer to a LOGFONT structure that describes the selected font.

Remarks

See also

Hierarchy Chart
Classes
CMFCPropertyGridCtrl Class
CMFCPropertyGridProperty Class