将所有系统字体添加到listBox? [英] add all system Fonts to listBox?
本文介绍了将所有系统字体添加到listBox?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨亲爱的
如何在列表框或comboBox中显示计算机上的全部字体?
感谢
Hi dear
how i can show total fonts that is on my computer in a listbox or comboBox?
thanks
推荐答案
此处提供了一些链接,这些链接详细说明了如何执行此操作.
托管字体组合框 [ FontComboBox-.NET的字体列表组合框 [附加链接1 [附加链接2 [
Here some links that explains how to do it in a detailed way.
Managed Font Combobox[^]
FontComboBox - a font listing combo box for .NET[^]
Additional link 1[^]
Additional link 2[^]
-or the shortest you can use this code;
List<string> fonts = new List<string>();
foreach (FontFamily font in System.Drawing.FontFamily.Families)
{
fonts.Add(font.Name);
}
并将组合框与列表绑定.
祝你好运
and bind the combobox with the list.
Good luck
看看这里提供的解决方案 ^ ]和此处绑定字体到C#中的下拉列表 [
Have a look at the solution provided here Binding Installed fonts in dropdownlist using LINQ[^] and here Bind fonts to a dropdownlist in C#[^]
可能会有所帮助,
It might be helpful,
cmbFonts.DataSource = System.Drawing.FontFamily.Families.Select(family => family.Name).ToList<string>();
:)
:)
这篇关于将所有系统字体添加到listBox?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文