How to create unstable font sizes?

I have created a TextBox on the code

RichTextBox tb3 = new RichTextBox();

Then I wrote an other code (in the same void) to change it's font:

tb3.Font.Size(FontSize.Text);

But the following error appeares : "non-invocable member 'Font Size' cannot be used like a method.

Note: "FontSize" is an ID for a textbox.

How can I do it without creating a new Font? Please help!

1 answer

  • answered 2018-04-14 14:25 Irakli Gabisonia

    tb3.Font.Size isn't a method, it is

    public float Size { get; }

    and you can't change it so.

    if you want to change font see it -> link1 and it link2

    you should create new font, for example:

    tb3.Font = new Font(tb3.Font.FontFamily, 23, FontStyle.Regular);