zoukankan      html  css  js  c++  java
  • 获取 系统中所有可用的字体

    FontFamily[] ff = FontFamily.Families;

        // Loop and create a sample of each font.
        for (int x = 0; x < ff.Length; x++)
        {

            System.Drawing.Font font = null;

            // Create the font - based on the styles available.
            if (ff[x].IsStyleAvailable(FontStyle.Regular))
                font = new System.Drawing.Font(
                    ff[x].Name,
                    m_comboBox.Font.Size
                    );
            else if (ff[x].IsStyleAvailable(FontStyle.Bold))
                font = new System.Drawing.Font(
                    ff[x].Name,
                    m_comboBox.Font.Size,
                    FontStyle.Bold
                    );
            else if (ff[x].IsStyleAvailable(FontStyle.Italic))
                font = new System.Drawing.Font(
                    ff[x].Name,
                    m_comboBox.Font.Size,
                    FontStyle.Italic
                    );
            else if (ff[x].IsStyleAvailable(FontStyle.Strikeout))
                font = new System.Drawing.Font(
                    ff[x].Name,
                    m_comboBox.Font.Size,
                    FontStyle.Strikeout
                    );
            else if (ff[x].IsStyleAvailable(FontStyle.Underline))
                font = new System.Drawing.Font(
                    ff[x].Name,
                    m_comboBox.Font.Size,
                    FontStyle.Underline
                    );

            // Should we add the item?
            if (font != null)
                m_comboBox.Items.Add(font);

        } // End for all the fonts.

  • 相关阅读:
    002 课程导学
    006 实例1-温度转换
    003 Python基本语法元素
    PHP读取文件头(2字节)判断文件类型(转)
    常见的浏览器Hack技巧总结(转)
    晨曦之光 linux Crontab 使用(转)
    实用技巧:简单而有用的nohup命令介绍(转)
    shell之“>/dev/null 2>&1” 详解(转)
    phpmailer邮件类下载(转)
    PHP拦截器的使用(转)
  • 原文地址:https://www.cnblogs.com/stone/p/120119.html
Copyright © 2011-2022 走看看