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
dataGridView doesn't respect font settings if new form's Font != DefaultFont #3033
Is this a blocker? If so, what is the impact? We need to have a good justification for the servicing team.
Yes of course! Grid control is totally broken - you can't customize fonts!!! In migration (to core) terms: every grid with custom fonts (in our apps it's all of them - 100%) are broken.
Framework project
Set DataGridView ColumnHeadersDefaultCellStyle , run project and DataGridView Style show correctly. Then modify the Form font in Properties Window, Form1.Desginer. cs will be updated and influence DataGridVeiw style Settings, as follows:
Core project
Copy the DataGridView ColumnHeadersDefaultCellStyle Settings from the Framework project, run project and DataGridView Style show correctly.
Then add code “this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));” in Form1.Desginer.cs to change the Form Font, run project and DataGridView does not display the style of setting, result as below:
Confirmed - setting the form font breaks dataGridView fonts...
Due to the change of the default font in core, we had to explicitly set the font in each form during migration.
Hi @RussKie . I have reproduced this issue on .NET Framework (4.7.1 and 4.8) and .NET Core (3.1 and 5.0). Issue is reproduced when Form's file contains next code: this.Font = new System.Drawing.Font(...)
CTI team also reproduced it on .NET Framework project (#3033 (comment)).
I asked CTI team verify it and confirm. If this is confirmed, then we must remove the regression label
If this is confirmed, then we must remove the regression label
I'd still consider fixing this important (and arguably a regression), since porting applications to .NET Core currently requires setting the font and thus triggering the bug, while on Desktop you could get away with not setting it.
Alternatively implement #3001 then fixing this issue is (probably?) not so important anymore.
Verified the issue with .NET SDK 5.0.100-rtm.20513.7 that the issue has been fixed that in runtime, the font of DataGridView ColumnHeaders, Cell, Rowheaders is changed as design time
Activity
RussKie commentedon Apr 2, 2020
Is this a blocker? If so, what is the impact? We need to have a good justification for the servicing team.
kirsan31 commentedon Apr 3, 2020
@RussKie
Yes of course! Grid control is totally broken - you can't customize fonts!!! In migration (to core) terms: every grid with custom fonts (in our apps it's all of them - 100%) are broken.
Lydia-Shi commentedon Apr 8, 2020
Set DataGridView ColumnHeadersDefaultCellStyle , run project and DataGridView Style show correctly. Then modify the Form font in Properties Window, Form1.Desginer. cs will be updated and influence DataGridVeiw style Settings, as follows:
Copy the DataGridView ColumnHeadersDefaultCellStyle Settings from the Framework project, run project and DataGridView Style show correctly.
Then add code “this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));” in Form1.Desginer.cs to change the Form Font, run project and DataGridView does not display the style of setting, result as below:
kirsan31 commentedon Apr 8, 2020
Confirmed - setting the form font breaks dataGridView fonts...
Due to the change of the default font in core, we had to explicitly set the font in each form during migration.
SergeySmirnov-Akvelon commentedon Jul 16, 2020
Hi @RussKie . I have reproduced this issue on .NET Framework (4.7.1 and 4.8) and .NET Core (3.1 and 5.0). Issue is reproduced when Form's file contains next code:
this.Font = new System.Drawing.Font(...)CTI team also reproduced it on .NET Framework project (#3033 (comment)).
I asked CTI team verify it and confirm. If this is confirmed, then we must remove the regression label
weltkante commentedon Jul 16, 2020
I'd still consider fixing this important (and arguably a regression), since porting applications to .NET Core currently requires setting the font and thus triggering the bug, while on Desktop you could get away with not setting it.
Alternatively implement #3001 then fixing this issue is (probably?) not so important anymore.
kirsan31 commentedon Jul 16, 2020
@SergeySmirnov-Akvelon
This is not exactly the truth. Strictly speaking the problem appear when the
form Font != DefaultFont.So this line
will not break .net Framework version. And this:
will not break .net core version.
@weltkante
I am afraid that this will not help :( ...
Also, during testing, I found that changing the form's Font - will delete ColumnHeadersDefaultCellStyle and RowHeadersDefaultCellStyle 😳
RussKie commentedon Jul 16, 2020
Please raise in the designer repo. /cc: @merriemcgaw
34 remaining items
Zheng-Li01 commentedon Oct 14, 2020
Verified the issue with .NET SDK 5.0.100-rtm.20513.7 that the issue has been fixed that in runtime, the font of DataGridView ColumnHeaders, Cell, Rowheaders is changed as design time