void CVisualSynanView::OnFonts() { CFontDialog dlgFonts; if( dlgFonts.DoModal() != IDOK) return; LOGFONT lfOldFont; LogFontCpy(&lfOldFont, m_LogFontForWords); dlgFonts.GetCurrentFont(&m_LogFontForWords); CString str = dlgFonts.GetFaceName(); CClientDC dc(this); EnumFontFamiliesEx(dc.m_hDC, &m_LogFontForWords, &TestIfTrueTypeEx,(LPARAM)this,0); if( !m_bExistUsefulFont ) { ::AfxMessageBox(IDS_NOT_TRUE_TYPE); LogFontCpy(&m_LogFontForWords,lfOldFont); return; } if(!(m_LogFontForWords.lfCharSet & RUSSIAN_CHARSET) ) { ::AfxMessageBox(IDS_NOT_RUSSIAN_CHARSET); LogFontCpy(&m_LogFontForWords,lfOldFont); return; }; // m_LogFontForWords has changed!! UpdateFontsFromLogFont(); CClientDC clDC(this); Recalculate(clDC); Invalidate(); }
void mydialog::sfont() { CFontDialog dlg; CString str; int size; long style; CFont ff; int i=dlg.DoModal(); if(i==IDCANCEL) return; str=dlg.GetFaceName(); size=dlg.GetSize(); LOGFONT lf; lf.lfHeight =dlg.GetSize(); memset(&lf,0,sizeof lf); str=dlg.GetFaceName(); if(dlg.IsItalic()) lf.lfItalic =1; if(dlg.IsUnderline()) lf.lfUnderline=1; if(dlg.IsBold()) lf.lfWeight=700; if(dlg.IsStrikeOut()) lf.lfStrikeOut=1; lf.lfHeight =size/10+10; char s[32]="Arial"; strcpy(lf.lfFaceName,str); ff.CreateFontIndirect(&lf); e1.SetWindowText("dfdfsdfsfsd"); e1.SetFont(&ff); }
///////////////////////////////////// // @mfunc menu handler - display a window font selection dialog and set font attributes for style at caret position // @rvalue void | not used // void CScintillamfcView::OnOptionsSetfont() { CFontDialog dlg; if (dlg.DoModal() == IDOK) { m_wndScintilla.SetFontname(m_wndScintilla.GetCurrentStyle(), dlg.GetFaceName()); m_wndScintilla.SetFontheight(m_wndScintilla.GetCurrentStyle(), dlg.GetSize()/10); m_wndScintilla.SetBold(m_wndScintilla.GetCurrentStyle(), dlg.IsBold()); m_wndScintilla.SetItalic(m_wndScintilla.GetCurrentStyle(), dlg.IsItalic()); m_wndScintilla.SetUnderline(m_wndScintilla.GetCurrentStyle(), dlg.IsUnderline()); } }
void DlgSetPrintStyle::OnButtonSelectFont() { // TODO: Add your control notification handler code here CFontDialog cfd; cfd.m_cf.Flags |= ( CF_NOSTYLESEL | CF_NOSIZESEL); if (cfd.DoModal() == IDOK) { m_strFont = cfd.GetFaceName(); m_wndFontName.SetWindowText(m_strFont); } }
void CfgAppearanceFontDlg::OnCustomFontTextBrowse(void) { xpr_tchar_t sFont[MAX_FONT_TEXT + 1] = {0}; GetDlgItemText(IDC_CFG_FONT_CUSTOM_FONT_TEXT, sFont, MAX_FONT_TEXT); LOGFONT sLogFont = {0}; StringToLogFont(sFont, sLogFont); CFontDialog sDlg; sDlg.m_cf.Flags &= ~CF_EFFECTS; sDlg.m_cf.Flags |= CF_INITTOLOGFONTSTRUCT; memcpy(sDlg.m_cf.lpLogFont, &sLogFont, sizeof(LOGFONT)); if (sDlg.DoModal() == IDOK) { xpr_tchar_t sText[MAX_FONT_TEXT + 1] = {0}; FontDlgToString(sDlg.GetFaceName(), sDlg.GetSize(), sDlg.GetWeight(), sDlg.IsItalic(), sDlg.IsStrikeOut(), sDlg.IsUnderline(), sText); SetDlgItemText(IDC_CFG_FONT_CUSTOM_FONT_TEXT, sText); setModified(); } }