Net Core 3.1 issues
See original GitHub issueHi! I tried to build your library with my Net Core 3.1 app (since they introduce WinForms for it) and have some differences with control positioning/size compared to build for net framework.
- Controls mostly look shifted down by ~5 pixels
- Input box height looks thinner by ~5 pixels
- Custom control placed by code shows in wrong place,
- Form’s upper blue strip renders with white holes, when controls are placed on it 5 Tab selector is longer, when it should be and so on Possibly, it is same position/size issue - i cannot find out why it happen.
I understand, that there is no need to port for unconsistent technology (lack of constructor), but since MS claims Core 3.1 winforms itself production-ready, maybe you kindly agree to investigate it a little?
Note that WinForms Constructor for Core still does not work properly, even in last VS 2019 16.6.0 Preview 6.0 (it wolud be fully completed near december, they say), but you can trick it to use old Constructor, changing target platform in project file like this:
<TargetFrameworks>net48;netcoreapp3.1</TargetFrameworks>
instead of
<TargetFramework>netcoreapp3.1</TargetFramework>
then rebuild for net48 and reload - old constructor will work.
To build for core, just change target expanding project execution button in VS
My whole project file for Core (they changed format):
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> <PropertyGroup> <OutputType>Library</OutputType> <TargetFrameworks>net48;netcoreapp3.1</TargetFrameworks> <UseWindowsForms>true</UseWindowsForms> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> </PropertyGroup> </Project>
Thank you!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top GitHub Comments
It is definitely “DPI-aware” issue. Since net 4.7 there is so called per-display DPI awareness. People have issues with it not only in WinForms, but also in WPF. If dpi-awareness disabled - app looks blurred when display set to 150 dpi for example. Net itself have whole tjing to handle high-dpi displaying, but it needs additional effort (more for winforms). In my case i decided disabling all that by setting
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
instead of defaultthis.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
and my app looks exactly as it was in net framework. Consider adding “dpi awareness” to your great lib. It will not be too complicated, you need to convert units and react to Control.DpiChangedAfterParent, Control.DpiChangedBeforeParent, Form.DpiChanged eventsFurther reading: https://stackoverflow.com/questions/22735174/how-to-write-winforms-code-that-auto-scales-to-system-font-and-dpi-settings https://stackoverflow.com/questions/13228185/how-to-configure-an-app-to-run-correctly-on-a-machine-with-a-high-dpi-setting-e http://crsouza.com/2015/04/13/how-to-fix-blurry-windows-forms-windows-in-high-dpi-settings/ SVG (vector, scalable) graphics: https://github.com/vvvv/SVG
Good to know! Thanks