Open ItEndsWithTens opened 5 years ago
Thanks for reporting the issue, sorry for the late response. I think the WinForms platform needs some major refactoring how the preferred size and layout is done. Currently a lot of (excessive) code is done to set the MinimumSize of controls to their preferred size which is a terrible way to do it.
Ideally, Eto should be using overrides to OnLayout() and GetPreferredSize() for container controls to properly translate Eto's layout system to Windows.Forms.
When creating a custom dialog in WinForms, there seem to be some circumstances under which TableLayouts aren't autosized correctly. I wish I could say what exactly those circumstances are, but they apparently involve TabControls and GroupBoxes.
Expected Behavior
A dialog, with tab control, containing some nested table layouts and group boxes, defaults to a size that shows all the controls (this being just an example I arrived at by manually resizing the dialog, but I'd expect something similar):
Actual Behavior
The dialog isn't the minimum possible, but is much smaller than I think is appropriate considering what controls are inside it:
Steps to Reproduce the Problem
To reproduce the screenshots above:
A simpler reproduction, that's hopefully easier to debug, is available with the "Spawn simple Dialog" button:
Specifications
Operating System(s): Windows 10 version 1809
Might be worth noting that WPF also had a problem with the complex dialog's "Invert Y" checkbox text getting cut off that was solved by switching from 2.4.1 to 2.5.0-ci-10208. I don't know if that offers any insight into what might be different between the platforms.
I'm fully prepared for this to be my own misuse of Eto's layout features, but even after reading the TableLayout docs, and issue #1299, I haven't been able to wrap my walnut brain around what I'm doing wrong. I've been trying to figure this out for a little bit now, and didn't want to open an issue unnecessarily, but I have the impression you're ramping up development toward version 2.5, and didn't want to risk possibly letting something slip past.
Currently my actual project is just setting the dialog box in question to have an absolute initial size, at some fraction of the primary screen's dimensions, but that strikes me as fragile, and by rights I think it should be only as large as necessary for the controls it contains.
Of course, another point would be "why not stop using WinForms altogether", but I'm doing 3D rendering work, and despite my long term desire to use WPF, in the short term performance with embedded graphics stuff leaves something to be desired. I know WinForms is extra effort to maintain, so I don't want to suggest this is a pressing issue, I'd just like to find out if this is in fact only an oversight on my part.