You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The code generated by the DataGridView control has extra code for the RowTemplate.Height property #4461
area-VSDesignerWindows Forms out-of-proc designer related issuestenet-compatibilityIncompatibility with previous versions or with WinForms for .NET Framework
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:
Create a Winforms .Net Core application.
Add a DataGridView to from designer.
Double click to open Form1.Designer.cs file in Solution Explorer.
Observe the generated code of the dataGridView1.
Note from Dustin: DataGridViewRow.Height has a [DefaultValue(22)] attribute, so the code-gen above is expected if the value is 25.
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.
There is a complete out of sync between the real values and what the designer shows.
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.
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.
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.
Reacted by Tanya Solyanik, kirsan31 and Dmitry Kazennov
ghost locked as resolved and limited conversation to collaborators on Apr 2, 2023
area-VSDesignerWindows Forms out-of-proc designer related issuestenet-compatibilityIncompatibility with previous versions or with WinForms for .NET Framework
Activity
Tanya-Solyanik commentedon Jan 13, 2021
DefaultValueAttribute should be adjusted to match the new default font
RussKie commentedon Feb 21, 2022
Similar to #4463 (comment).
Closing due to age. We can reopen it if/when we receive customer feedback.
kirsan31 commentedon Feb 21, 2022
@RussKie
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 toForm1.Designer.cs. You need to open properties ofdataGridView1for this.DGV1.mp4
17 remaining items
dkazennov commentedon Jan 9, 2023
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.
kirsan31 commentedon Jan 27, 2023
@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 :(
paul1956 commentedon Jan 27, 2023
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.
or
Are there any test that compare results after each edit to look for side effects?
Tanya-Solyanik commentedon Feb 6, 2023
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.
kirsan31 commentedon Feb 6, 2023
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.
Wil do...
dmitrii-drobotov commentedon Feb 7, 2023
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?
kirsan31 commentedon Feb 7, 2023
@dmitrii-drobotov
Yes, they are 👍
Do I still need to create a new issue with them + description from original post?
dkazennov commentedon Feb 7, 2023
@kirsan31 it would be great to have a new issue. Thanks!
kirsan31 commentedon Feb 8, 2023
Done: #8593
Nora-Zhou01 commentedon Mar 3, 2023
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.
