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

Changing font from code dynamically

3 Answers 563 Views
Themes and Visual Style Builder
This is a migrated thread and some comments may be shown as answers.
reza
Top achievements
Rank 1
reza asked on 23 May 2012, 10:12 PM
Hi,
I need to change my application's font dynamically,when I set the font of main window without setting theme everything works fine
but unfortunately when I set the theme changing font not working.
Is there any way to change the font of controls dynamically after setting theme?

3 Answers, 1 is accepted

Sort by
0
Boryana
Telerik team
answered on 28 May 2012, 11:40 AM
Hi reza,

Thank you for writing.

Our themes apply font repositories to the RootElements of RadControls. For this reason, if you would like to change the font dynamically, you will need to iterate the controls and assign them the appropriate font. For example, to change the font of a RadForm with a RadButton on it use the following code:
Font f = new Font(new FontFamily("Segoe UI"), 9f);
this.Font = f;
this.radButton1.Font = f;

I hope this helps. Let me know if you encounter further issues.

Kind regards,
Boryana
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Alireza
Top achievements
Rank 1
answered on 03 Jan 2015, 06:10 PM
Hi Boryana
I have used your code, but unfortunately that did not work. Please, help me
0
Hristo
Telerik team
answered on 07 Jan 2015, 12:37 PM
Hi Alireza,

Thank you for writing.

I was unable to reproduce your problem. Please find attached a sample project and a screenshot of an applied TelerikMetro theme and modified from code font of the present controls.

If you still experience problems on setting the fonts dynamically please give us more details of your particular case.

I hope this information is useful. Should you have further questions please do not hesitate to write back.

Regards,
Hristo
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Themes and Visual Style Builder
Asked by
reza
Top achievements
Rank 1
Answers by
Boryana
Telerik team
Alireza
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or