【问题标题】:Change font for once instance of Krypton Button更改 Krypton Button 的一次实例的字体
【发布时间】:2016-12-06 18:27:26
【问题描述】:

如何以编程方式放大在 KryptonButton 的一个实例中使用的字体?

krytonButton.Font可以改,但是好像没什么效果。

kryptonButton.StateCommon.GetContentShortTextFont(bar) 也返回一个 Font,但所有的访问器都是 getter,而且 Fonts 也是只读的。

【问题讨论】:

    标签: c# krypton-toolkit


    【解决方案1】:

    我知道这有点晚了,但这可能会在未来帮助其他人。

    KryptonLabel kryptonLabel = new KryptonLabel();
    FontFamily fontFamily = new FontFamily("Arial");
    Font font = new Font(fontFamily, 30, FontStyle.Regular, GraphicsUnit.Pixel);
    kryptonLabel.StateCommon.ShortText.Font = font;
    

    您必须将短文本属性设置为新字体。如果您想尽可能地保留字体,请尝试在创建新字体时读取以前的字体值。

    Font fontUpdatedSize = new Font(kryptonLabel.StateCommon.ShortText.Font.FontFamily,
                                            30,
                                            kryptonLabel.StateCommon.ShortText.Font.Style,
                                            GraphicsUnit.Pixel);
    kryptonLabel.StateCommon.ShortText.Font = font;
    

    【讨论】:

      猜你喜欢
      • 2015-05-20
      • 1970-01-01
      • 2017-06-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-01
      • 1970-01-01
      • 2018-12-31
      相关资源
      最近更新 更多