I've searched for days and nothing worked.
I'm working on a project using a custom style for WinForm called MaterialSkin, github page is https://github.com/IgnaceMaes/MaterialSkin
Basically to use it, I just change the inherited class from this public partial class FormMain : Form
to this public partial class FormMain : MaterialForm
and this applies the Material Design to my project.
The problem is that all controls are affected by this change. If I add a label, and change it font, the visual change only works in design mode, when I run the project, the MaterialSkin font is applied (Roboto).
Now I want to use a custom control called CircularProgressBar from this repo https://github.com/falahati/CircularProgressBar
And the problem is the same, I want a big number in center of the circle, and it works in design mode. When I run the project, the font size is reduced to 8,5.
I'm already tried to set the new font manually to the CircularProgressBar in Form_Load event and also in OnPaint, nothing work.
Any ideas about what I missing?
As suggested by @Jimi, I'm posting the minimal code below to reproduce the problem I'm facing.
Windows Forms App (.NET Framework) v4.6.1
MaterialSkin.2 v2.1.3 (not the latest)
by leocb, IgnaceMaesCircularProgressBar v2.8.0.16
by Soroush FalahatiForm1.cs
and made the necessary changes to load MaterialSkinCircularProgressBar
control to Form1
, Build and Run.// Form1.cs
using MaterialSkin;
using MaterialSkin.Controls;
namespace SimpleTestProject
{
public partial class Form1 : MaterialForm
{
private readonly MaterialSkinManager materialSkinManager = null;
public Form1()
{
InitializeComponent();
materialSkinManager = MaterialSkinManager.Instance;
materialSkinManager.AddFormToManage(this);
materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT;
}
}
}
As suggested by @Jimi and @Leo, to avoid applying MaterialSkin style to all controls, just need to disable the MaterialSkinManager
property called EnforceBackcolorOnAllComponents
materialSkinManager.EnforceBackcolorOnAllComponents = false;