views:

444

answers:

1

Hi All,

By using CMFCPropertyGridProperty::GetValue I'm able to get the contents of the property grid.

I have one property though that gets the font, where when you click on it, shows a dialog box to select the font, size and style.

Using this code:

CMFCPropertyGridProperty* pCurSel = m_wndPropList.GetCurSel();

CString test = pCurSel->GetValue();

I'm able to get the string on the field, However if you get the value as a string, you ONLY get the font name and the font size [ ex. tahoma(8) ]. I would like to get the value as a string so I could write these values on an XML file. The dialog box for selecting font, size and style must be returning a value of type DWORD (I suppose). But how do I extract it's return value so that I would literally get what is selected like 'tahoma', '10', and 'Bold'?

Please help... thanks...

A: 
CMFCPropertyGridProperty* pCurSel = m_wndPropList.GetCurSel();
CMFCPropertyGridFontProperty* pFontProp = dynamic_cast<CMFCPropertyGridFontProperty*>(pCurSel);
if ( pFontProp ) {
  LPLOGFONT font_info = pFontProp->GetLogFont();
  // use font_info fields
}

LOGFONT structure description

Kirill V. Lyadvinsky