This is a migrated thread and some comments may be shown as answers.

Change the font of a button generated programaticly

2 Answers 939 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 22 May 2015, 08:33 AM

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 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 22 May 2015, 09:44 AM
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
0
Martin
Top achievements
Rank 1
answered on 22 May 2015, 09:46 AM

Thank you very much ! This helps me a lot ! 

Also thanks for the quick answer !

With best regards,

Martin.

Tags
Buttons, RadioButton, CheckBox, etc
Asked by
Martin
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Martin
Top achievements
Rank 1
Share this question
or