获取系统的字体

InstalledFontCollection ifc = new InstalledFontCollection();
                FontFamily[] ff = ifc.Families;
                DropDownList6.Items.Clear();
                //先加中文的字体
                foreach (FontFamily f in ff)
                {
                    if (Regex.IsMatch(f.Name, @"[\u4e00-\u9fa5]+"))
                    {
                        DropDownList6.Items.Add(f.Name);
                    }
                }
                //再加英文字体
                foreach (FontFamily f in ff)
                {
                    if (!Regex.IsMatch(f.Name, @"[\u4e00-\u9fa5]+"))
                    {
                        DropDownList6.Items.Add(f.Name);
                    }
                }
posted @ 2011-09-16 16:20  DODUI  阅读(181)  评论(0编辑  收藏  举报