Changing font from code dynamically

4 posts, 0 answers
  1. reza
    reza avatar
    6 posts
    Member since:
    Jan 2009

    Posted 23 May 2012 Link to this post

    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?
  2. Boryana
    Admin
    Boryana avatar
    330 posts

    Posted 28 May 2012 Link to this post

    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 >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Alireza
    Alireza avatar
    5 posts
    Member since:
    Nov 2014

    Posted 03 Jan 2015 in reply to Boryana Link to this post

    Hi Boryana
    I have used your code, but unfortunately that did not work. Please, help me
  5. Hristo
    Admin
    Hristo avatar
    716 posts

    Posted 07 Jan 2015 Link to this post

    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.

     
Back to Top