zoukankan      html  css  js  c++  java
  • wpf获取系统字体

    wpf获取系统安装的字体很简单,

    foreach (FontFamily fontfamily in Fonts.SystemFontFamilies)

    {

      //代码

    }

    获取中文字体

    foreach (FontFamily fontfamily in Fonts.SystemFontFamilies)
                {
                    LanguageSpecificStringDictionary fontdics = fontfamily.FamilyNames;
                    //判断该字体是不是中文字体
                    if (fontdics.ContainsKey(XmlLanguage.GetLanguage("zh-cn")))
                    {
                        string fontfamilyname = null;
                        if (fontdics.TryGetValue(XmlLanguage.GetLanguage("zh-cn"), out fontfamilyname))
                        {
                            systemFontsNamesList.Add(fontfamilyname);
                        }
                    }

         //英文字体
                    else
                    {
                        string fontfamilyname = null;
                        if (fontdics.TryGetValue(XmlLanguage.GetLanguage("en-us"), out fontfamilyname))
                        {
                            systemFontsNamesList.Add(fontfamilyname);
                        }
                    }
                }

  • 相关阅读:
    day09-文件的操作
    day08-字符编码
    day07补充-数据类型总结及拷贝
    day07-列表类型/元组类型/字典类型/集合类型内置方法
    auth-booster配置和使用(yii1.5)
    yii中常用路径
    yii中 columnszii.widgets.grid.CGridView
    yii框架widget和注册asset的例子
    yii后台模板标签
    yii中获取当前模块,控制器,方法
  • 原文地址:https://www.cnblogs.com/renpeng/p/4364194.html
Copyright © 2011-2022 走看看