C#怎么获取windows系统支持的字体以及字体样式

编程开发 C#windows字体字体样式

首先引用 System.Drawing.dll

代码如下:

           //如何获得系统字体列表
            System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();

            ///字体列表
            List<System.Drawing.FontFamily> FontFamilys = new List<System.Drawing.FontFamily>();

            foreach (System.Drawing.FontFamily family in fonts.Families)
            {
                FontFamilys.Add(family);
            }

            ///字体样式列表
            List<string> FontStyles = new List<string>();
相关推荐
免责声明 本站部分内容来源于互联网公开资源分享学习交流,若其中有侵犯到了您的权益 还请邮件联系我方删除