zoukankan      html  css  js  c++  java
  • VC:CFontDialog(CClientDC 、GetDeviceCaps()、memset、LOGFONT、memcpy、CFont、SelectObject() 、IsStrikeOut())

           //CFontDialog( LPLOGFONT lplfInitial = NULL, DWORD dwFlags = CF_EFFECTS | CF_SCREENFONTS, CDC* pdcPrinter = NULL, CWnd* pParentWnd = NULL );

                  // Show the font dialog with 12 point "Times New Roman" as the

           // selected font.

    /*    LOGFONT lf;

           memset(&lf, 0, sizeof(LOGFONT));

           CClientDC dc(this);

           lf.lfHeight = -MulDiv(12, dc.GetDeviceCaps(LOGPIXELSY), 72);

           strcpy(lf.lfFaceName, "Times New Roman");

           CFontDialog dlg(&lf);

           dlg.DoModal();*/

           /*

           CFontDialog dlg;

    if (dlg.DoModal() == IDOK)

    {

       // Create the font using the selected font from CFontDialog.

       LOGFONT lf;

       memcpy(&lf, dlg.m_cf.lpLogFont, sizeof(LOGFONT));

       CFont font;

       VERIFY(font.CreateFontIndirect(&lf));

       // Do something with the font just created...

       CClientDC dc(this);

       CFont* def_font = dc.SelectObject(&font);

       dc.TextOut(5, 5, "Hello", 5);

       dc.SelectObject(def_font);

       // Done with the font. Delete the font object.

       font.DeleteObject();

    }*/

           CString fontmessage="";

           CFontDialog dlg;

           if( IDOK==dlg.DoModal())

           {

                  fontmessage="字体名称:";

                  fontmessage+=dlg.GetFaceName();

                  if(1==dlg.IsStrikeOut())

                         fontmessage+="字体有删除线";

                  else

                         fontmessage+="字体没有删除线";

                  if(1==dlg.IsUnderline())

                         fontmessage+="字体有下划线";

                  else

                         fontmessage+="字体没有下划线";

                  if(1==dlg.IsBold())

                         fontmessage+="字体被加粗";

                  else

                         fontmessage+="字体没有被加粗";

                  if(1==dlg.IsItalic())

                         fontmessage+="字体是斜体";

                  else

                         fontmessage+="字体不是斜体";

                  AfxMessageBox(fontmessage);

           }

  • 相关阅读:
    散列点斜率算法解剖
    c# 3d图像显示
    .net core 运行不需命令行
    c# 异步调用(异步模式,基于事件)
    分配在堆上还是分配在栈上及其区别
    c# 自定义按钮,渐变颜色(含中心向四周渐变,单方向渐变)
    玩转Web值jquery(一)---对表单中的某一标签批量处理(以input为例)
    设计模式 模版方法模式 展现程序员的一天
    【Android进阶】Android面试题目整理与讲解(二)
    【Android进阶】让程序运行效率更高的编程技巧总结
  • 原文地址:https://www.cnblogs.com/shenchao/p/2737752.html
Copyright © 2011-2022 走看看