how to maintain font size when theme is applied ?

Hi all.

I have some buttons and labels on a form, so I'm planning to add some theme options to the form.

but it seems that when the theme is selected, the font size in the buttons and labels doesn't maintain the size I set earlier, and it looks like it's the theme's default size. 

any suggestions for that?

Thank You.


15 Replies 1 reply marked as answer

DM Dhanasekar Mohanraj Syncfusion Team October 21, 2022 02:02 PM UTC

Hi RIDWAN,

The provided details are not enough to proceed further. Could you please share the below things,

  1. In Which controls you are facing the reported issue?

  2. Video illustration of the reported issue


It will be helpful for us to check on it and provide you with a solution at the earliest.

Regards,

Dhanasekar M.



RI RIDWAN October 22, 2022 09:27 AM UTC

kkoyTfXSHd.pngsfButton1 and sfButton2 themes are not applied

jdx2cfMQtx.png
  sfButton1 and sfButton2 after themes is applied

sfButton1 and sfButton2 text before applying the theme I set them with the font setting "Segoe UI Semibold; 20pt".

but, after I press "Set style Office2016Black" the text font size of sfButton1 and sfButton2 changes not as I set initially.

I want, when the style is applied, both buttons stay with the text size and font type I set.


sorry if my explanation is wrong



RI RIDWAN replied to Dhanasekar Mohanraj October 22, 2022 09:46 AM UTC

Sorry in advance if it's a hassle.. to achieve what I want it seems to just set this code on each control:

            sfButton1.Font = new Font(" Segoe UI Semibold", 18F);

but is there any other way to make it look simple? instead i add that code to all the controls in some form i have ?



SS Sethuramkumar Senthilkumar Syncfusion Team October 24, 2022 01:31 PM UTC

Hi RIDWAN,

We are currently checking your reported issue with the provided information. So, we need two more business days to validate this.
We will update with further details on October 27, 2022.

We appreciate your patience until then.

Regards,
Sethuramkumar S



RI RIDWAN replied to Sethuramkumar Senthilkumar October 25, 2022 01:21 PM UTC

I am happy to wait for further news sir..

Thank you for your response.



GT Gokul Thanudhas Syncfusion Team November 3, 2022 01:38 PM UTC

Hi Ridwan,



We have confirmed the reported scenario is a defect and logged a report for the reported scenario “Font Size is changed while changing the theme at runtime in SfButton”. We will provide the fix in the NuGet version on 22nd November 2022.


You can track the status of this defect using the following feedback link:       

Font Size is changed while changing the theme at runtime in WinForms | Feedback Portal (syncfusion.com)


If you have any more specification replication procedures or a scenario to be tested, you can add it as a comment in the portal.

    

Please let us know if you need any further assistance.


Regards,

Gokul T



HN Harinath Navaneethakrishnan Syncfusion Team November 23, 2022 11:11 AM UTC

Sorry for the inconvenience, 

 

We are still working on this issue with high priority. We will update you on the fix in our upcoming NuGet release which is scheduled on 29th November 2022. 

 

We appreciate your patience until then. 


Marked as answer

HN Harinath Navaneethakrishnan Syncfusion Team November 29, 2022 02:17 PM UTC

We have included the fix in our latest Weekly NuGet release v20.3.0.59 which is available for download (https://www.nuget.org/). We thank you for your support and appreciate your patience in waiting for this update. Please get in touch with us if you would require any further assistance.



RI RIDWAN replied to Harinath Navaneethakrishnan November 30, 2022 03:57 AM UTC

I've tried it, and the results are amazing..



HN Harinath Navaneethakrishnan Syncfusion Team November 30, 2022 03:10 PM UTC

We are glad to know that your issue has been fixed. Please let us know if you need any other assistance. We are happy to assist you.



AS ashraful September 25, 2024 08:19 PM UTC

I am facing this same issue. I have shared some screen shots. When I click on the button it executes the following code and I get the small font controls. Please take necessary step as soon as possible thank you. 


SkinManager.SetVisualStyle(this, "HighContrastBlack");

UpdateStyles();

Image_2668_1727295459980


Image_3158_1727295381732



SS Sekar Sivalingam Syncfusion Team September 26, 2024 09:36 AM UTC

Hi ashraful,

We are unable to reproduce the reported issue "Theme selection overrides initial font sizes in SfButton" from our end. Please refer to the attached sample and video for your reference.

If we misunderstood your query, Could you please share the following details? It will help us to provide better solution asap.

  • Code snippets that you have used for SfButton
  • please provide more details about your requirement with a screenshot or video.
  • If possible, please share modified sample to replicate the issue.


Regards,

Sekar Sivalingam


Attachment: SfButtonFont_2ed1d1af.zip


AS ashraful September 26, 2024 01:30 PM UTC

Dear Sekar Sivalingam,

Please see the attached project. You will understand the problem.


Attachment: WindowsFormsApp1_d20ffee5.zip


KA Karthick Arjunan Syncfusion Team September 27, 2024 01:05 PM UTC

Hi Ashraful,


We have confirmed the reported scenario is a defect and logged a report for the reported scenario “Font size is changed while changing theme at runtime in WinForms TextBoxExt”. We will provide the fix in our weekly NuGet release, which is scheduled on before 15th October 2024.

 

You can track the status of this defect using the following feedback link: Font size is changed while changing theme at runtime in WinForms TextBoxExt in WinForms | Feedback Portal (syncfusion.com)

 

If you have any more specification replication procedures or a scenario to be tested, you can add it as a comment in the portal.

 

Please let us know if you need any further assistance.

  

Note: The provided feedback link is private, and you need to log in to view this feedback.

 

Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”


Regards,

Karthick Arjunan



SS Sekar Sivalingam Syncfusion Team October 4, 2024 07:41 AM UTC

Hi Ashraful,

Upon further analysis, we found that the `ThemeStyle.Font` property of the control is used to render text in the new themes (HighContrast, Office2019). We recommend setting the `ThemeStyle.Font` property to retain the same font when switching to the HighContrastBlack theme.

 

https://help.syncfusion.com/windowsforms/skins/getting-started#styles

 

Code Snippets:

 

private void Button1_Click(object sender, System.EventArgs e)
{
     this.textBoxExt1.ThemeStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 27.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     SkinManager.SetVisualStyle(this, "HighContrastBlack");
     this.UpdateStyles();
}


Attachment: WindowsFormsApp1_d20ffee5_(2)_50ff0822.zip

Loader.
Up arrow icon