[HDPI] SystemAware controls inside containers anchored with Bottom or Right are messed up.
.NET version
.Net9
Did it work in .NET Framework?
Not tested/verified, but I think - NO.
Did it work in any of the earlier releases of .NET Core or .NET 5+?
Not working with .Net8, and I think with oldest too.
Issue description
Form designed and launched with 125% dpi:
If AnchorStyles.Bottom is used then problems are more huge:
This is one of more others issues with anchoring Bottom / Right and HDPI: https://github.com/dotnet/winforms/issues/5076 https://github.com/dotnet/winforms/issues/8157 https://github.com/dotnet/winforms/issues/10958 https://github.com/dotnet/winforms/issues/11516 ...
Setting:
{
"configProperties": {
"System.Windows.Forms.AnchorLayoutV2": true
}
}
in runtimeconfig.template.json will solve the issues.
Steps to reproduce
@kirsan31 using the below configurations can make the controls inside containers scaled well.
{
"configProperties": {
"System.Windows.Forms.AnchorLayoutV2": true
}
}
https://github.com/user-attachments/assets/a6f475fa-2aa8-4059-be9b-e6c99c08a931
@Zheng-Li01 wow thanks. You are right AnchorLayoutV2 resolve this issues.
I completely missed everything related to AnchorLayoutV2 and it's clear why - there no any mentions about it in what's new for .Net8 🤷♂️ Google (except AI) also find almost nothing. And only after searching this repo I found the article: https://github.com/dotnet/winforms/blob/main/docs/design/anchor-layout-changes-in-net80.md
@Zheng-Li01 the instructions need more context, I believe I need to add a new file runtimeconfig.template.json in the same directory as my project file (if it does not exist) and then add or merge the JSON content above.
As @kirsan31 said this was very difficult to discover.
Using WinForms for ages and never heard of this switch...