Krypton-Suite / Standard-Toolkit

An update to Component factory's krypton toolkit to support .NET Framework 4.6.2 - 4.8.1 to .NET 6 - 8
BSD 3-Clause "New" or "Revised" License
405 stars 62 forks source link

[Feature Request]: Controls should have "min design heights" be the same. #615

Open MattH-Work opened 2 years ago

MattH-Work commented 2 years ago

It would be beneficial to allow 'input' controls (ComboBoxes, TextBoxes, NumericUpDown, DateTimePicker etc) to have their heights modifiable independently of the Font size.

Textbox height can change if set to multiline, whereas ComboBoxes (my main reason for this post) and other controls are linked to their font size

Default Heights Textbox 23 NumericUpDown 22 Combox 21 DateTimePicker 21

It’s only a pixel here and there ( slight OCD triggering, 1st world problems and all! ), but its noticeable when controls don't line up on forms

I do note that the height increases when using ButtonSpec, or adding Rounding to the borders, so it feels the code for manipulating the heights exists in the background

PWagner1 commented 2 years ago

@Smurf-IV Is this possible?

Smurf-IV commented 2 years ago

Probably, But I think having them all the same size would be a good start !

MattH-Work commented 2 years ago

Recently found that changing Minimum & Maximum size

image

allows me to set the height of the control, which solves this particular issue for me

Smurf-IV commented 2 years ago

@MattH-Work Great find. @Wagnerp Controls should have "min design heights" be the same.

Smurf-IV commented 2 years ago

https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#change-description Make all controls 27% bigger !

Smurf-IV commented 4 months ago

https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#change-description Make all controls 27% bigger !

I'll make min heights to be 30, and that will cover both the above (i.e. 23 * 1.27 = 29.###) and when corners are used, and when a button spec is inserted.

Smurf-IV commented 4 months ago

The Problem is now that Up Downers and Drop Downs DO NOT FILL, into the larger space: image

Smurf-IV commented 4 months ago

Done and also make the NumUpDowner center when using a smaller font: image

Smurf-IV commented 4 months ago

Note: Won;t fix for V85 as there are tooo many changes

MattH-Work commented 4 months ago

https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#change-description Make all controls 27% bigger !

I'll make min heights to be 30, and that will cover both the above (i.e. 23 * 1.27 = 29.###) and when corners are used, and when a button spec is inserted.

I have all my krypton controls set to 25, will I still be able to reduce the height lower than the 30 ( standard ) minimum you have proposed via the controls minimum height designer setting?

Smurf-IV commented 4 months ago

I have all my krypton controls set to 25, will I still be able to reduce the height lower than the 30 ( standard ) minimum you have proposed via the controls minimum height designer setting?

Short answer: No.

Long Answer: Yes, it would be possible, as you would have to override the virtual function that sets the minimum (In each control and the base), but then this would not be compatible with:

Ahmed-Abdelhameed commented 3 months ago

@MattH-Work

This is not specific to Krypton controls. The corresponding WinForms controls (read: ComboBox, NumericUpDown, etc.) work the same way. Changing how the height of these controls is managed is likely to cause other problems if you're not careful (read more in my other comment).

As to the alignment issue, I also like my controls to be aligned but the WinForms designer already has tools to help with this. Check the Format menu. I even have custom shortcuts to help me align controls quickly.

image image

CC: @Smurf-IV CC: @Wagnerp

Smurf-IV commented 3 months ago

Now that this is re-opened (due to reverting the code!), This needs to be dealt with: image

Ahmed-Abdelhameed commented 3 months ago

Hi @Smurf-IV

I might be missing something obvious but is this relevant? Hasn't Krypton Toolkit always used a different default font (which happens to be Segoe UI 9 pt as well. How does changing the default font of Microsoft's WinForms controls come into play here?

MattH-Work commented 3 months ago

@MattH-Work

This is not specific to Krypton controls. The corresponding WinForms controls (read: ComboBox, NumericUpDown, etc.) work the same way. Changing how the height of these controls is managed is likely to cause other problems if you're not careful (read more in my other comment).

As to the alignment issue, I also like my controls to be aligned but the WinForms designer already has tools to help with this. Check the Format menu. I even have custom shortcuts to help me align controls quickly.

image image

CC: @Smurf-IV CC: @Wagnerp

I'm aware of the alignment controls and use them frequently, however, even with all controls aligned to 'tops', the bottoms are up and down, it just doesn't look professional, hence why I opted ( for an OCD pleasing ) 25 height for all my controls, small enough to fit all required controls on the page, large enough to see

Smurf-IV commented 3 months ago

Thanks for all the comments .. Keep them coming. What I see as problems for this are:

Proposal:

Thoughts ?

giduac commented 3 months ago

For interfaces with a lot of controls like VStudio controls that can/must be small are good to have like this one: image

First do a proof of concept to see:

From that PoC we can discuss further how to proceed.

MattH-Work commented 3 months ago

is it is possible to make all those controls resizable from a minimal fixed size to....?

Agreed. I like the idea of a standard height, uniform across all controls, but still needing the option to reduce / increase on a case by case basis using Minimum & Maximum Size control

image

what would be a minimal fixed size (to fit buttons specs)?

Being selfish, as my button spec images are based on a standared icon size of 16x16, having the default standard control height set to 25 seems spot on

image

make all these controls react to the alignment properties

Not sure what you mean, don't they already align by tops, lefts, middles etc?

giduac commented 3 months ago

is it is possible to make all those controls resizable from a minimal fixed size to....?

Agreed. I like the idea of a standard height, uniform across all controls, but still needing the option to reduce / increase on a case by case basis using Minimum & Maximum Size control

image

what would be a minimal fixed size (to fit buttons specs)?

Being selfish, as my button spec images are based on a standared icon size of 16x16, having the default standard control height set to 25 seems spot on

image

make all these controls react to the alignment properties

Not sure what you mean, don't they already align by tops, lefts, middles etc?

Yes, some control's alignments properties IIRC need a check. The minimum height can be a constraint. The standard sizes used by each control should be the same as it's WinForms counterpart or as close to it as can be.

Ahmed-Abdelhameed commented 3 months ago

Hi @Smurf-IV CC: @giduac & @MattH-Work

Note that even when Microsoft made the change you referred to above in .NET Core 3.0, they didn't increase the MinimumSize of the controls. They changed the font, which increased the default (not minimum) size of some controls.

I'm not opposed to making changes to the default size, but I don't see a good reason to change the minimum size of all control. Maybe some controls need to have their size constrained (for example, a KTextBox with ButtonSpecs currently, doesn't shrink even if you use the smallest font possible, which is good), but this should be done on a control-by-control basis (where warranted), to avoid unintended side effects.

They need to work for different "Base Fonts" (which just happen to be Segoe UI for V9)

Is there a problem with that currently?

They need to be sensible min size

Default size? Maybe. Min size? I don't know. Why?

and the insertion of buttons specs and not overly "Resize"

Maybe having a max size for button specs would help here?

PWagner1 commented 3 months ago

Hi @MattH-Work, @Smurf-IV, @giduac & @Ahmed-Abdelhameed

Should I turn this into a discussion?

MattH-Work commented 3 months ago

See some additional thoughts here https://github.com/Krypton-Suite/Standard-Toolkit/pull/1636#issuecomment-2238667774

Smurf-IV commented 3 months ago

@MattH-Work

So to wrap it up, give us a consistent default height, but still allow it to be altered ( reduced & increased ) via Minimum & Maximum height setting in the designer, which would then give correct 'alignment' results

Is that not what you already have ? (AS you have already demonstrated via you use of MinSize !)

Thanks for the Layout diagrams you did in the merge conversation, Can I ask that you perform a "Max Size" reduction as well ? to see what Winforms and Krypton do ?

Smurf-IV commented 3 months ago

Hi @MattH-Work, @Smurf-IV, @giduac & @Ahmed-Abdelhameed

Should I turn this into a discussion?

No, AS things get lost "Over there" As "New things are discovered" then just create related linked articles.. i.e. #1651

Smurf-IV commented 3 months ago

@MattH-Work My 1.5 cents on this.

1 If you go for a fixed initial height existing interfaces need to be reformatted, imo that's undesired.
2 Making all controls sizeable would be a great plus.
3 If a proof of concept is done minimum / maximum size and corresponding font heights can be explored and tested.

1 - Agreed, Hence V90 only work. 2 - That is currently possible as has been demonstrated via the use of MinSize 3a - Not sure what this means, but as has already been seen Winforms and Krypton both have quirks ! 3b - What could be done (And hence via related articles) is

Smurf-IV commented 3 months ago

Hi @Smurf-IV CC: @giduac & @MattH-Work

1 - Note that even when Microsoft made the change you referred to above in .NET Core 3.0, they didn't increase the MinimumSize of the controls. They changed the font, which increased the default (not minimum) size of some controls.

2 - I'm not opposed to making changes to the default size, but I don't see a good reason to change the minimum size of all control. Maybe some controls need to have their size constrained (for example, a KTextBox with ButtonSpecs currently, doesn't shrink even if you use the smallest font possible, which is good), but this should be done on a control-by-control basis (where warranted), to avoid unintended side effects.

They need to work for different "Base Fonts" (which just happen to be Segoe UI for V9)

3 - Is there a problem with that currently?

They need to be sensible min size

4 - Default size? Maybe. Min size? I don't know. Why?

and the insertion of buttons specs and not overly "Resize"

5 - Maybe having a max size for button specs would help here?

1 - Ok, So Krypton accidentally did the same by also using Segoe UI 9pt ;-) 2 / 4 - As above: "Have the minSize recommendation set for new controls, (but not an enforced minsize as per original PR) that can be "reset" to Original Winform "messed up" heights" 3 - Yes, Still using a 9pt font but using "Small characters" then controls like the number up downer "Get confused": image The image shows what happens with the PR - Before it was rolled back. Now that is has been rolled back, the font and the buttons will be "Rammed" into the top of the control but because it's still a 9pt layout the "Height" of the control will still be the same !!! 5 - I think it is based on the image ans having a padding around it, then the "Height" of the control has to be able to "Take it!"