DateTimePicker garbled after Windows 10 Creators Update
Asked Answered
C

12

8

Application built with VS 2015, C#, Winforms, using the DateTimePicker Windows control, text is garbled after updating machines to the Windows Creators Update.

Garbled Text Image

Has anyone else come across this or is there any suggested work around ?

Comply answered 13/4, 2017 at 16:18 Comment(5)
The Before image looks just as garbled as the After image. :-)Ransome
Haha... Thats a screen shot of the actual form. Pay no attention to the labels. /Jedi hand waveComply
Do you have a High-DPI display? I'll bet dpi scaling is at fault here.Heiskell
Great call.... It doesn't seem to be the issue though. Actually created a test form with just a DateTimePicker formatted the same as the legacy app and it does NOT exhibit this behavior. Plot thickens.Comply
Same problem here after Windows Creators Update (and in some cases text is long spaced horizontally). The text control is okay in Visual Studio but garbled when running the app. Changing font, units and size doesn't helped. Other text controls renders fine, so looks like a bug.Ron
C
3

The June cumulative update for Windows 10 (KB 4022725) includes an updated COMCTL32.DLL that contains a fix for this issue. The file version should be 5.82.15063.413 after the update is installed.

https://social.msdn.microsoft.com/Forums/en-US/4cf03067-46c4-4962-af8c-f4b1483e88ba/date-time-picker-garbled-after-windows-10-creators-update?forum=windowsgeneraldevelopmentissues

Curable answered 14/6, 2017 at 9:6 Comment(0)
M
5

Enable Visual Styles in the WinForms application, before the Form containing the DateTimePicker is shown.

Application.EnableVisualStyles();

//Form1 contains the DateTimePicker component
Application.Run(new Form1());
Melisa answered 26/4, 2017 at 19:56 Comment(3)
This one worked, thanks a lot ! After testing everything else without any success, this is the only thing that worked without changing any other params (fonts, sizes, manifest...)Ron
In my case Form1 doesn't contains the DateTimePicker component, but enabling styles before Application.Run(Form) fixed many other forms that included a DateTimePicker componentRon
This solution alter the visual style of multiple components, but in my case is usable (and acceptable)Ron
C
3

The June cumulative update for Windows 10 (KB 4022725) includes an updated COMCTL32.DLL that contains a fix for this issue. The file version should be 5.82.15063.413 after the update is installed.

https://social.msdn.microsoft.com/Forums/en-US/4cf03067-46c4-4962-af8c-f4b1483e88ba/date-time-picker-garbled-after-windows-10-creators-update?forum=windowsgeneraldevelopmentissues

Curable answered 14/6, 2017 at 9:6 Comment(0)
H
2

Do you have a High-DPI display? Even if you don't, there's a good chance the updated dpi scaling is at fault here. If so, you might be able to "fix" this simply by setting a value in dpiAware and dpiAwareness values of the manifest file for your project as described here:

High-DPI Scaling Improvements for Desktop Applications in the Windows 10 Creators Update

I haven't had to do this myself yet, so right now I can only point you where to look, and not to what the exact right values should be for your situation.

Even if this isn't your issue, you may want to spend a few minutes checking that your app handles well in High-DPI situation. It's also a decent excuse to get your company to buy you a nice new monitor :)

Heiskell answered 13/4, 2017 at 16:45 Comment(3)
Great information. I'll do this and run a new build. It will take a while to push to a system with the issue and report back.Comply
Modification of any DPI related settings in the manifest did not seem to impact this. Under the compatibility properties, setting it to Windows 8 (or lower, it didn't really matter) DID help but did not completely fix the issue. The text is now spaced horizontally vs being garbled so it's usable if not pretty. We are getting a Win 10 creators update development VM going and will tackle this. I'd love to upvote your answer as it got me going in the right direction but, I don't have the rep to do that.Comply
Don't worry... I don't really need the rep :)Heiskell
B
2

Enabling XP Visual Styles fixed it for me.

Bricky answered 24/4, 2017 at 17:10 Comment(1)
Could you post the process to do this? It would help others to easily determine if this would work for them as well. Thanks!Comply
S
2

So Windows 10 1703 has introduced some new challenges, among them this weird refusal to display a date in the DateTimePicker control, unless you tick the "Enable XP visual style" box for the application (or do it programmatically). This tweak does fix the date-rendition issue, but now other controls, such as dropdown boxes, dropdown lists text boxes and buttons become flat and dreary. Not good. What we do need is a real fix which makes the "XP visual style" unnecessary, or is Windows Forms programming on the way out and so not interesting to support?

Saavedra answered 4/5, 2017 at 14:43 Comment(0)
P
1

I have also come across this today. My datetimepicker was rendered very randomly, but never acceptible. I have this as a sort-of workaround: My environment is VS2015, .net 3.5 and winforms My setup is Surface Pro 3 with the new docker and 2 external monitors res 2560x1440 and scaling 100%. Added app.manifest to my project as I did not have it before. Added the dpiAware to app.manifest to be System like this:

<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>      
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/System</dpiAware>
</windowsSettings>
</application>

I also set the AutoScaleMode to None on my form (but got approx the same result with Inherited). The dpiAware seemed to help (but not 100% stable). This does work when running a compiled application, but does NOT work when debugging from Visual Studio. Then I only get a period (.) that is my date separation sign.

sample of datetimepicker after updating to creators update after applying workaround when running compiled exe

this can help a bit if unable to update application to .net 4.7

Phantasmal answered 19/4, 2017 at 12:28 Comment(4)
Nor the app.manifest or using .net 4.7 solved my issue (testing in Visual Studio 2017)Ron
In .net 4.7 did you try the PerMonitorV2 dpiAwareness as described here? blogs.windows.com/buildingapps/2017/04/04/…Phantasmal
Yes, no improvements. I even tried adjusting the Compatibility settings of the application with no success neither. All other winforms components are rendered okay, so I suspect is a bug in the Windows Creator update.Ron
this was not stable enough, I too had to use the Application.EnableVisualStyles with its cons to ensure DateTimePickerPhantasmal
C
0

So, we wound up deleting the manifest file and the control now renders correctly. What's odd is just the fact of including a new manifest file with only an assemblyIdentity tag with version and name causes this windows control to freak out. I realize that for others, deleting the manifest may not be an option, but, this has fixed our issue.

Comply answered 14/4, 2017 at 16:47 Comment(1)
Loosing styling turned out not to be an option so instead of removing the manifest, we just used an infragistics control to work around it. Not exactly a fix but at least I can get a build out the door.Comply
M
0

We are receiving this exact same issue. VB.NET VS 2012 .NET 4.5. THe datetimepicker is messed up. I have also posted this on

https://connect.microsoft.com/VisualStudio/feedback/details/3129203/date-in-datetime-of-mfc-application-is-getting-cropped-in-win10-redstone2-build-15055

Metatarsal answered 21/4, 2017 at 20:56 Comment(0)
K
0

I tried most of the suggestions here and in other places including manifest changes, .NET 4.7, etc. However, one additional change that was required in my setup was to increase the CalendarFont size on the control itself.

The default on my system was 7.875. Changing it to 10pt corrected the display issue (changing it to a slightly lower value improved the display but did not correct it).

Disclaimer: This has not been tested in-depth and may break other scenarios. This information is intended to assist in finding a final solution.

Kariekaril answered 25/4, 2017 at 17:18 Comment(4)
Tried different fonts, sizes and units with .Net 4.7, but the problem persists. Dates are overlapped, garbled, hyperspaced or even disappears.Ron
Did you test on a high DPI or normal resolution device? Did you adjust the CalendarFont or the Font property?Kariekaril
I tested the CalendarFont change under a normal resolution device and the display problem was not corrected.Kariekaril
The final piece of the puzzle for me was to add Application.EnableVisualStyles() to main(). This altered the app's appearance considerably but it can now run correctly in all three environments (pre-CU, CU w/normal res, and CU w/high res).Kariekaril
C
0

Like other have suggested, had this line to your main form and it worked for me:

Application.EnableVisualStyles()

You can also uncomment the lines at the bottom in the app.manifest. It depends of the project.

Cyte answered 27/4, 2017 at 12:52 Comment(0)
D
0

A fix for this issue is scheduled to be included in the June cumulative update for Windows 10.

Discounter answered 11/5, 2017 at 21:28 Comment(3)
Could you provide any reference to this statement?Winifred
we are in June, the update released but the problem remains :(Curable
The June cumulative update for Windows 10 (KB 4022725) includes an updated COMCTL32.DLL that contains a fix for this issue. The file version should be 5.82.15063.413 after the update is installed.Discounter
B
0

This is a bug in the Date Time Picker control implemented in COMCTL32.DLL version 5. There should be a fix for this issue in the near future.

The Date Time Picker control implemented in COMCTL32.DLL version 6 does not appear to be affected by this issue.

Brought answered 29/5, 2017 at 12:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.