Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UserControl #382

Open
pmcstjean opened this issue Apr 25, 2023 · 6 comments
Open

UserControl #382

pmcstjean opened this issue Apr 25, 2023 · 6 comments

Comments

@pmcstjean
Copy link

Are UserControl supported or not ? I read that they were not : #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 ?

@EthanielK
Copy link

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

@pmcstjean
Copy link
Author

pmcstjean commented Apr 26, 2023

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.

@valimaties
Copy link

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.

@pmcstjean
Copy link
Author

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

@InfiSoftApps
Copy link

InfiSoftApps commented May 24, 2023

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.

@valimaties
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants