leocb / MaterialSkin

Theming .NET WinForms, C# or VB.Net, to Google's Material Design Principles.
MIT License
438 stars 132 forks source link

MaterialMessageBox issue on dark theme & size #261

Closed Simonaalina25 closed 2 years ago

Simonaalina25 commented 2 years ago

Hi! While working with the latest released version (2.2.1) I noticed some visual problems with MaterialMessageBox. Firstly, when applying the dark theme the panel behind the Rich TextBox won't change it's color to the dark version if the EnforceBackcolorOnAllComponents is set to false. Secondly, if I tried to have a MaterialMessageBoxwith 3 buttons, the left one (Cancel in my case) it won't be shown because the sizing of the Box only depends on the text written in the Rich TextBox. Here's the current behaviour: MaterialMsgBox Initial

In my application I changed FelxibleMaterialDialog.cs by setting the backcolor of the panel accoring to the theme and by calculating the size of the MessageBox based on the number of visible buttons too. Now, everything works okay. Here's the output:

MaterialMsgBox Final

valimaties commented 2 years ago

Hi Simona. You might center those buttons in the resized form.

Edit: IMO, the simplest way is to add those buttons in a Panel, anchor them in that panel (left button to the left, right button to the right, and the middle one to the center). How those buttons will display is how the panel is anchored to Flexible form. Displaying only one or two buttons will resize the panel, of course. If you don't have time, I will think of it :)

Simonaalina25 commented 2 years ago

I was thinking about centering them at first, but in case of a very long string the buttons would have a lot of spaces between them. The way it's done now they are anchored to the right all the time.

MaterialMsgBox Long Msg Final

valimaties commented 2 years ago

I was thinking about centering them at first, but in case of a very long string the buttons would have a lot of spaces between them. The way it's done now they are anchored to the right all the time.

If buttons are childs of a panel, and the panel has the size of buttons (and spaces between them) this means all buttons will be "grouped" in center of screen. Today I'll bring my contribution :)

Edit: Done! Without using a panel, repositioning buttons according to number of buttons used and ButtonsPosition parameter from MaterialMessageBox parameter list.