Change the font of a button generated programaticly

3 posts, 1 answers
  1. Martin
    Martin avatar
    3 posts
    Member since:
    May 2015

    Posted 22 May 2015 Link to this post

    Hello guys ! I'm currently working on a project in C# with Visual Studio 2013 and Telerik for Winforms 2013.

    I'm generating buttons in my program (buttons used for user login), and i'd like to change the font of the buttons i'm generating, but as you may have guessed, since they're not in the program until i launch it, i'd like to know if there's a command to change them directly into the code before generating them.

    Thank you for your answers.

    With many regards,

    Martin.

  2. Answer
    Dess
    Admin
    Dess avatar
    1609 posts

    Posted 22 May 2015 Link to this post

    Hello Martin,

    Thank you for writing.

    In order to change the button's font programmatically, you can set the RadButton.Font property:
    public Form1()
    {
        InitializeComponent();
     
        Font f = new System.Drawing.Font("Verdana",12f, FontStyle.Italic);
        RadButton button = new RadButton();
        this.Controls.Add(button);
        button.Text = "Button";
        button.Font = f;
    }

    I hope this information helps. Should you have further questions, I would be glad to help.
     
    Regards,
    Dess
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Martin
    Martin avatar
    3 posts
    Member since:
    May 2015

    Posted 22 May 2015 in reply to Dess Link to this post

    Thank you very much ! This helps me a lot ! 

    Also thanks for the quick answer !

    With best regards,

    Martin.

Back to Top