次の方法で共有


CFontDialog::m_cf

メンバーがダイアログ オブジェクトの特性を格納する構造体。

CHOOSEFONT m_cf;

解説

CFontDialog のオブジェクトを構築すると、DoModal のメンバー関数を呼び出す前に、ダイアログ ボックスのさまざまな側面を変更するに m_cf を使用できます。この構造体の詳細については、Windows SDKの CHOOSEFONT を参照してください。

使用例

// The code fragment creates a font based on the information 
// we got from CFontDialog::m_cf variable.

CFontDialog dlg;
if (dlg.DoModal() == IDOK)
{
   // Create the font using the selected font from CFontDialog.
   LOGFONT lf;
   memcpy(&lf, dlg.m_cf.lpLogFont, sizeof(LOGFONT));

   CFont font;
   VERIFY(font.CreateFontIndirect(&lf));

   // Do something with the font just created...
   CClientDC dc(this);
   CFont* def_font = dc.SelectObject(&font);
   dc.TextOut(5, 5, _T("Hello"), 5);
   dc.SelectObject(def_font);

   // Done with the font. Delete the font object.
   font.DeleteObject();
}

必要条件

ヘッダー : afxdlgs.h

参照

関連項目

CFontDialog クラス

階層図