zoukankan      html  css  js  c++  java
  • paip.提升用户体验=c++ qt 字体切换功能缺少的总结..

    paip.提升用户体验=----c++ qt 字体切换功能缺少的总结..


    作者Attilax ,  EMAIL:1466519819@qq.com 
    来源:attilax的专栏
    地址:http://blog.csdn.net/attilax




    建立磊个字体,三,qt黑头切换了,费要重启才能了...这个用户体验k不好了阿.


    做为一个编辑器..应该要加个字体切换功能了...


    主要的原理式EnumFontFamiliesEx,回调个函数..不个他放的个Listbox上..


    EnumFontFamiliesEx
    //


    函数功能:该函数列举系统里所有符合由LOGFONT结构指定的字体特性的字体。此函数基于字样名或字符集或两者来枚举字体。
    函数原型:int EnumFontFamiliesEx(HDC hdc, LPLOGFONT lpLogfont, FONTENUMPROC lpEnumFontFamExProc, LPARAM lParam, DWORD dwFlags);




    枚举所有字体

    LOGFONT lf;
    lf.lfCharSet = DEFAULT_CHARSET; // Initialize the LOGFONT structure
    strcpy(lf.lfFaceName,"");
    CClientDC dc (this);


    //Enumerate the font families
    ::EnumFontFamiliesEx((HDC) dc,&lf,
    (FONTENUMPROC) EnumFontFamProc,(LPARAM) this,0);


    //枚举函数
    int CALLBACK EnumFontFamProc(LPENUMLOGFONT lpelf,LPNEWTEXTMETRIC lpntm,DWORD nFontType,long lparam)
    {
        // Create a pointer to the dialog window
        CDay7Dlg* pWnd = (CDay7Dlg*) lparam;
        // add the font name to the list box


        pWnd ->m_ctlFontList.AddString(lpelf ->elfLogFont.lfFaceName);


        // Return 1 to continue font enumeration
        return 1;
    }
    其中m_ctlFontList是一个列表控件变量


    参考:
    如何获取系统的字体? - CSDN论坛 - CSDN.NET.htm
    EnumFontFamiliesEx_百度百科.htm
  • 相关阅读:
    mac与ip为什么同时存在
    tcp四次挥手
    tcp三次握手
    GET与POST的区别
    Servlet.service() for servlet [jsp] in context ....错误
    c3p0连接数据库时注意事项
    finalize()及垃圾回收
    composer 安装新包失败的原因之一
    如何使用优酷开放平台获取视频播放列表
    php解析优酷网上的视频资源去广告
  • 原文地址:https://www.cnblogs.com/attilax/p/15199517.html
Copyright © 2011-2022 走看看