コード例 #1
0
/////////////////////////////////////
// @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
ファイル: dlg.cpp プロジェクト: knotverygood/CollegeCode
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);

}
コード例 #3
0
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();
    }
}