怎么做一个这样的下拉菜单

来源:百度知道 编辑:UC知道 时间:2024/06/21 21:22:28
VB9(2008)的答案(也许2005的可以给下)

这个下拉菜单里放着所有的字体名称
不会转换+VB6的不行

C#的,你转换一下吧

private void getFont()
{
//如何获得系统字体列表
System.Drawing.Text.InstalledFontCollection fonts=new System.Drawing.Text.InstalledFontCollection();
foreach(System.Drawing.FontFamily ff in fonts.Families)
{
this.comboBox1.Items.Add(ff.Name);
}

//如何获得系统字体样式

foreach(int i in Enum.GetValues(typeof(System.Drawing.FontStyle)))
{

this.comboBox2.Items.Add(i.ToString(Enum.GetName(typeof(System.Drawing.FontStyle),i)));
}
}

vb代码
Private Sub Command1_Click()
Combo1.Clear
Dim I
For I = 0 To Screen.FontCount - 1
Combo1.AddItem (Screen.Fonts(I))
Next I
End Sub