C++_CFontDialog字体选择对话框

LOGFONT* pLogFont = new LOGFONT;
CFontDialog dlg(pLogFont );//构造函数初始化字体
COLORREF color=RGB(0,255,0);
dlg.m_cf.rgbColors = color;颜色则需要单独设置
if(IDOK == dlg.DoModal())
{
   dlg.GetCurrentFont(pLogFont);
   color = dlg.m_cf.rgbColors;
   //字体大小
   int nFontSize = dlg.m_cf.iPointSize / 10;
}

CString strFontColor;
strFontColor.Format( _T( "%08X" ), color);//strFontColor是#00FF00
LOGFONT* pLogFont = new LOGFONT;
pLogFont .lfHeight		     = m_plftSaveLogFont->lfHeight;			
pLogFont .lfWidth		     = m_plftSaveLogFont->lfWidth;			
pLogFont .lfEscapement	     = m_plftSaveLogFont->lfEscapement;		
pLogFont .lfOrientation	     = m_plftSaveLogFont->lfOrientation;	
pLogFont .lfWeight		     = m_plftSaveLogFont->lfWeight;	//粗体		
pLogFont .lfItalic		     = m_plftSaveLogFont->lfItalic;//斜体			
pLogFont .lfUnderline		 = m_plftSaveLogFont->lfUnderline;	//下划线	
pLogFont .lfStrikeOut	     = m_plftSaveLogFont->lfStrikeOut;	//删除线	
pLogFont .lfCharSet		     = m_plftSaveLogFont->lfCharSet;		
pLogFont .lfOutPrecision	 = m_plftSaveLogFont->lfOutPrecision;	
pLogFont .lfClipPrecision	 = m_plftSaveLogFont->lfClipPrecision;	
pLogFont .lfQuality		     = m_plftSaveLogFont->lfQuality;		
pLogFont .lfPitchAndFamily   = m_plftSaveLogFont->lfPitchAndFamily;	
_tcscpy ( pLogFont .lfFaceName, m_strFontFace ); //字体(宋书,楷书等)


CFont* pFont =  new CFont;
pFont.CreateFontIndirect(pLogFont );

 

转载于:https://my.oschina.net/u/2930533/blog/1935196

  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 扫一扫,分享海报

参与评论 您还未登录,请先 登录 后发表或查看评论
©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值