术语 | CDateTimeCtrl::SetMonthCalFont | ||||
释义 | CDateTimeCtrl::SetMonthCalFont void SetMonthCalFont(HFONT hFont, BOOL bRedraw = TRUE); 参数:
说明: 与联机文档“平台SDK”中描述的一样,这个成员函数实现Win32消息DTM_SETMCFONT的功能。 示例: // The following code example creates a font // (Arial, 10 pixels high) and if successful, // stores the result in m_pMonthFont. SetMonthCalFont // is then called passing in the new font, causing // the month calendar control to display all // text and dates with an Arial font. BOOL CYourDialog::OnInitDialog() { CDialog::OnInitDialog(); // ... other code here ... //initializing the necessary members of the LOGFONT // structure m_pMonthFont = new CFont; LOGFONT lf; memset(&lf, 0, sizeof(lf)); lf.lfHeight = 10; strcpy(lf.lfFaceName, "Arial"); if (m_pMonthFont->CreateFontIndirect(&lf)) { // if successful, grab the month calendar control from // our dialog and set the font CMonthCalCtrl* pCtrl = (CMonthCalCtrl*) GetDlgItem(IDC_DATETIME1); ASSERT(pCtrl != NULL); pCtrl->SetMonthCalFont(m_pMonthFont); } else { // if not successful, clean up the font pointer and // set equal to NULL delete m_pMonthFont; m_pMonthFont = NULL; } // ... other code here ... } CYourDialog::CYourDialog(CWnd* pParent /*=NULL*/) : CDialog(CYourDialog::IDD, pParent) { // ... other code here ... m_pMonthFont = NULL; // ... other code here ... } CYourDialog::~CYourDialog() { // ... other code here ... delete m_pMonthFont; // ... other code here ... } 注意: 如果使用这段代码,可以产生CFont类型的m_pMonthFont,是一个CDialog派生类的成员。 请参阅:CDateTimeCtrl::GetMonthCalFont |
||||
随便看 |
|
MFC类库中文详解手册包含4274条MFC类库参考词条,基本涵盖了Microsoft基本类库中的类、全局函数、全局变量和宏的内容,是计算机编程的有利工具。