怎么用combobox来控制字体大小啊?
如题,我在WPF下用Combobox来控制Label的字体大小,可是不成功,请问该怎么写?
private void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
label1.FontFamily = new FontFamily(comboBox1.SelectedItem.ToString());
//label1.Fontsize = combobox.text.toString();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
System.Drawing.FontFamily[] families = System.Drawing.FontFamily.Families;
foreach (System.Drawing.FontFamily family in families)
comboBox1.Items.Add(family.Name);
}
这是一道例题,通过这个可以达到用comboBox1来更改字体,现在老师要求我加一个combobox来更改字体大小。。。跪求大神帮忙
------解决方案--------------------
改字体大小,那字体大小列表在哪呢,如果在另一个combox中那就
Label1.Font = new Font(new FontFamily(comboBox1.Text), Conver.ToInt32(comboBox2.Text));