/////////////////////////////////////
// @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());
	}
}
예제 #2
0
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);

}