Change font for once instance of Krypton Button

1.1k views Asked by At

How do I programatically enlarge the font used in one instance of the KryptonButton?

krytonButton.Font can be changed, but it seems to have no effect.

kryptonButton.StateCommon.GetContentShortTextFont(bar) also returns a Font, but all the accessors are getters only, and Fonts are also read-only.

1

There are 1 answers

0
mizukame On BEST ANSWER

I know it's a bit late, but this might help someone else out in the future.

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

You will have to set the short text property to a new Font. If you want to maintain the font as much as possible try reading the previous font values when creating your new Font.

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