zoukankan      html  css  js  c++  java
  • [Winform][C#]获取系统颜色预定义颜色和现有字体集

    转自: http://zhidao.baidu.com/link?url=ozY7tJRNBYHUsImE6jn1psqc8owib7MWcDMEmZw48q8iD9Hz9MWgnQQcBDO0VYOFXGv4hi8RVmOidouvpmZL-K
    public static void GetFontAndColor()
    {
        //使用如下命令就可以得到当前系统所有字体
        InstalledFontCollection MyFont = new InstalledFontCollection();
        List<FontFamily> listf = new List<FontFamily>();
        FontFamily[] MyFontFamilies = MyFont.Families;
        //InstalledFontCollection 对象只看得见在创建它之前安装在 Windows 中的字体。如果用c#创建安装字体程序要使用GDIAddFontResource 函数
        InstalledFontCollection fc = new InstalledFontCollection();
        foreach (FontFamily font in fc.Families)
        {
            listf.Add(font);
        }
        //获取系统颜色预定义颜色
        Array colors = System.Enum.GetValues(typeof(KnownColor));
        List<KnownColor> listc = new List<KnownColor>();
        foreach (KnownColor colorName in colors)
        {
            listc.Add(colorName);
        }
    }

     //不要使用 InstalledFontCollection 类在 Windows 中安装字体。而应使用 GDIAddFontResource 函数。InstalledFontCollection 对象只看得见在创建它之前安装在 Windows 中的字体。

  • 相关阅读:
    堆排序
    伽马分布
    隔壁-贪心
    对刚—约瑟夫环
    站军姿-两圆并集
    单纯的线性筛素数
    3兔子
    2.圆桌游戏
    1.花
    历史
  • 原文地址:https://www.cnblogs.com/z5337/p/5144143.html
Copyright © 2011-2022 走看看