The edit field of Date Time Picker can't display date correctly in a .NET Framework 4.7-based application

Si applica a: .NET Framework.NET Framework 4.7

Summary


Date field inside the Windows Forms DateTimePicker control might be rendered incorrectly in applications running on Windows 10 Creators Update. Rendering issues might include extra spaces, or missing text, depending on the Format property value.

Format set to Long:

Format set to Long

Format set to Short:

Format set to Short

Format set to Time:

Format set to Time

This issue occurs when the application loads Comctl32.dll Version 5 on Windows 10 Creators Update.

Workaround


Note Applications that use Comctl32.dll Version 6 work correctly.

To work around this issue, use Comctl32 Version 6 by enabling Visual Styles in the app.manifest file as follows:

  <dependency>    <dependentAssembly>      <assemblyIdentity           type="win32"           name="Microsoft.Windows.Common-Controls"          version="6.0.0.0"          processorArchitecture="*"          publicKeyToken="6595b64144ccf1df"          language="*"        />    </dependentAssembly>  </dependency> 
 

More information


This issue is caused by a change in native date time picker control in ComCtl32.dll V5, where control’s edit field is not formatted correctly.

For more information, see Enabling Visual Styles and Application.EnableVisualStyles Method ().

For more information about known issues in the .NET Framework 4.7, see Known issues for .NET Framework 4.7.