Closed Tanya-Solyanik closed 1 year ago
DefaultValueAttribute should be adjusted to match the new default font
Similar to https://github.com/dotnet/winforms/issues/4463#issuecomment-768831519.
Closing due to age. We can reopen it if/when we receive customer feedback.
@RussKie
Closing due to age. We can reopen it if/when we receive customer feedback.
You have it for a long time already.
I was hoping that when you deal with this issue, I will be able to raise that too. Instead, you closed this one :)
Current issue is more fatal then my previous. To break Font scaling in my reported issue you was needed to add some styles. But with this - when simple adding new DataGridView (not always - see below) to the form - you completely break DPI and Font scaling 😁 And even if you fix it manually, you have to do it again and again after every use of the designer...
Details:
this.dataGridView1.RowTemplate.Height = 25;
line not always adding to Form1.Designer.cs
. You need to open properties of dataGridView1
for this.Thank you for linking the bug.
@merriemcgaw can you please help prioritising this?
https://github.com/dotnet/winforms/issues/4463 should be considered as part of the fix.
/cc @merriemcgaw
@RussKie / @merriemcgaw this needs broader fix for every Control/Property impacted by the default Font change. So far i see two bugs in this context but there could be more.
We'll try to get to this in .NET 7, based on the feedback. We decided to do a deep dive into the default values and figure out what the best path foreword is.
I duplicated the feedback ticket: https://developercommunity.visualstudio.com/t/Setting-DataGridViewRowHeight--22-in-P/10227470 with this issue.
Thanks @John-Qiao @dmitrii-drobotov - is this something that can go on your team's backlog?
@dmitrii-drobotov - is this something that can go on your team's backlog?
Sure, I added it to our backlog.
Probably the best way to affect this Issue is to separate value of the Height property (in DataGridViewRow class) from the Thickness property (which in turn depends on Control.DefaultFont.Height). After that the DefaultValue attribute can be removed, new private const can be introduced as was proposed by @RussKie (with implementation of the Reset and ShouldSerialize methods).
This sets the correct intended value to the property in the property browser, and there is still the extra code.
@dkazennov thank you very match for doing this!
I want ask the team about related (but designer) issue - any chance this will be fixed? It's really very tiring to delete extra font instances every time after changing the form in the designer, and if you forget about it, font scaling breaks :(
I open 2 separate issue through Feedback with Extra Styles being generated for DataGridView and the format of the file alternates with every change (spaces are added and deleted) in comments and New Lines are deleted if initialized string is last before comment. Is the correct format for a comment the first or second, it seems to be inconsistent.
'
'Comment
'
or
'
' Comment
'
Are there any test that compare results after each edit to look for side effects?
I want ask the team about related (but designer) issue
The images are gone from the vs feedback website. @kirsan31 - could you please explain repro steps? Or even better - open individual issues in this repo.
@merriemcgaw - FYI.
The images are gone from the vs feedback website. @kirsan31 - could you please explain repro steps?
Yea they are gone :( But we have gif form one of the responses: https://user-images.githubusercontent.com/4403806/118398742-578e5b00-b69d-11eb-9181-35f1045fb1f3.gif that explain one part of the issue.
Or even better - open individual issues in this repo.
Wil do...
We have those images in the linked designer issue (https://github.com/microsoft/winforms-designer/issues/2225), I will duplicate it here as well: [pic1.png] [pic2.png] [gif1.gif] [gif2.gif]
@kirsan31 - can you confirm these are the same images from the feedback post?
@dmitrii-drobotov
@kirsan31 - can you confirm these are the same images from the feedback post?
Yes, they are 👍 Do I still need to create a new issue with them + description from original post?
@kirsan31 it would be great to have a new issue. Thanks!
Or even better - open individual issues in this repo.
Verified this on .NET latest build: 8.0.100-preview.3.23152.5, issue was fixed, RowTemplate.Height line cannot be generated and DataGridViewRow.Height value is 25. The screenshot as same as above.
.NET Core Version: 3.1+
Have you experienced this same bug with .NET Framework?: No
Problem description:
The generated code for dataGirdView1 has extra code for the RowTemplate.Height property. For the newly created control at 100% scaling, designer should generate the same value as is defined by the DefaultValueAttribute
Expected behavior: RowTemplate.Height line should not be generated
Minimal repro:
Note from Dustin: DataGridViewRow.Height has a [DefaultValue(22)] attribute, so the code-gen above is expected if the value is 25.