gpt4 book ai didi

wpf - 以编程方式更改标签属性

转载 作者:行者123 更新时间:2023-12-04 09:29:46 25 4
gpt4 key购买 nike

问题是我需要以编程方式更改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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com