问题是我需要以编程方式更改Label FontWeight和FontStyle,但似乎无济于事……这是我到目前为止已经尝试的方法:
label.FontWeight = FontWeight.FromOpenTypeWeight(99);
对于label.FontStyle我不知道,我被困在这里:
label.FontStyle = new FontStyle();
我不知道从那以后该怎么办。我像疯了似的谷歌搜索,但一无所获。
在此先感谢您的任何建议!
最佳答案
对于FontStyle,可以在后面的代码中使用FontStyles类,对于FontWeight,可以使用FontWeights。
private void Button_Click(object sender, RoutedEventArgs e)
{
uiLabel.FontWeight = FontWeights.Bold;
uiLabel.FontStyle = FontStyles.Italic;
}
关于wpf - 以编程方式更改标签属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/947614/