MaterialSkin icon indicating copy to clipboard operation
MaterialSkin copied to clipboard

UserControl

Open pmcstjean opened this issue 1 year ago • 6 comments

Are UserControl supported or not ? I read that they were not : https://github.com/leocb/MaterialSkin/issues/320

But so far, it looks like it's working on my side. The only problem I am experiencing is that the controls I put in my UserControl appears smaller. For example, I have a button with a given size on my main form and the same button in my UserControl too, and that one appears smaller.

Is there something I am missing ?

pmcstjean avatar Apr 25 '23 20:04 pmcstjean

Try changing the “AutoSize” of the button to “false”. Maybe it could help.

PixelKiwi avatar Apr 26 '23 00:04 PixelKiwi

It's already AutoSize=false. At design time these button are Size (40, 44) but at runtime they become (29, 30) when in the userControl (which is also inside a UC) and they stay the same when not in a UC. They contains only an icon, no text.

I tried to isolate the problem with a lighter test project, and the only difference is that it modifies the Size a little bit bigger instead of smaller (they become 46, 50). As soon as I set EnforceBackcolorOnAllComponents to false, the sizing problem disappear.

  materialSkinManager = MaterialSkinManager.Instance; 
  materialSkinManager.EnforceBackcolorOnAllComponents = false;
  materialSkinManager.AddFormToManage(this);

Obviously, setting this value to false is not an option, as it is causing some other problems.

pmcstjean avatar Apr 26 '23 14:04 pmcstjean

Hi @pmcstjean This project is not in development anymore. Is somehow deprecated. WinForms is also an old way of programming, if you want to do something, move yourself to WPF, MAUI or some other programming language. In WPF there is also a MaterialDesign theme if you want to use it!

Cheers.

valimaties avatar Apr 26 '23 21:04 valimaties

Thanks for sharing those options but I'll stick with the less dead of all the MS UI options ;) My humble opinion, of course.

pmcstjean avatar Apr 27 '23 17:04 pmcstjean

I found the Work around for the size issues.

Simply go to the designer file of YOUR UserControl (.designer.vb file)

Inside, Private Sub InitializeComponent() logic, comment out these 2 lines as below. Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font

image

Now you'll be able to use UC with no UI level glitch

Hope my solution helps you guys @pmcstjean, @Boiled-Yakult, @valimaties and others as well.

InfiSoftApps avatar May 24 '23 10:05 InfiSoftApps

I didn't say its not working, @InfiSoftApps ... I said that leo marked it as deprecated, it says in first page, in readme file. I didn't tried your solution, because I don't intend to use it anymore as long as the PR are not anymore merged, or merged very rare.

Regards, Vali

valimaties avatar May 25 '23 10:05 valimaties