BOOL COptionTreeFontSel::OnInitDialog() { CDialog::OnInitDialog(); // Microsoft makes it really hard to customize the Font dialog, so I created my own. // Declare variables CRect rcTemp; // Enable buttons // -- Default if (m_dwDialogFlags & OT_FS_USEDEFAULT) { m_ctlButtonDefault.ModifyStyle(0, WS_VISIBLE); // -- Move default button uo if (!(m_dwDialogFlags & OT_FS_USEAPPLY)) { m_ctlButtonApply.GetWindowRect(rcTemp); ScreenToClient(rcTemp); m_ctlButtonDefault.MoveWindow(rcTemp); } } // -- Apply if (m_dwDialogFlags & OT_FS_USEAPPLY) { m_ctlButtonApply.ModifyStyle(0, WS_VISIBLE); } // -- Text Color if (m_dwDialogFlags & OT_FS_NOTEXTCOLOR) { m_ctlButtonColor.EnableWindow(FALSE); } // -- Effects if (m_dwDialogFlags & OT_FS_NOEFFECTS) { m_ctlUnderline.EnableWindow(FALSE); m_ctlStrikeout.EnableWindow(FALSE); } // -- Styles if (m_dwDialogFlags & OT_FS_NOSTYLES) { m_ctlFontStyles.EnableWindow(FALSE); } // -- Face if (m_dwDialogFlags & OT_FS_NOFACE) { m_ctlFontNames.EnableWindow(FALSE); } // Load everything OnObjectsChanged(); // Select current font SelectCurFont(m_lfFont); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void COptionTreeFontSel::SetCurFont(LOGFONT lf) { // Save font m_lfFont = lf; // Objects changes OnObjectsChanged(); }
BOOL CFontPropPage::OnInitDialog() { CStockPropPage::OnInitDialog(); OnObjectsChanged(); IgnoreApply(AFX_IDC_FONTPROP); return TRUE; // return TRUE unless you set the focus to a control }
void COptionTreeFontSel::SetCurFont(CHARFORMAT cfFont) { // Declare variables LOGFONT lf = {0}; // Copy font ConvertFont(lf, cfFont); // Save font m_lfFont = lf; // Objects changes OnObjectsChanged(); }