.NET的DateTimePicker看起来很奇怪 [英] .Net DateTimePicker Looks Odd

查看:161
本文介绍了.NET的DateTimePicker看起来很奇怪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行在Windows 7旗舰版64位SP1 VS旗舰版2013(v12.0.31101.00更新4)。当我创建一个Windows窗体包含 System.Windows.Forms.DateTimePicker 和运行,历有充分的前场奇数垂直线:

I am running VS Ultimate 2013 (v12.0.31101.00 Update 4) within Windows 7 Ultimate x64 SP1. When I create a Windows Form that contains a System.Windows.Forms.DateTimePicker and run, the calendar has odd vertical lines before every field:

的DateTimePicker奇数垂直线

这些线出现,无论我是否在Release或Debug模式下运行,而我无论从内VS或通过双击在bin文件夹中生成的EXE运行。有谁知道如何摆脱的垂直线?

These lines appear regardless of whether I run in Release or Debug mode, and whether I run from within VS or by double-clicking the exe generated in the bin folder. Does anyone know how to get rid of the vertical lines?

- 编辑 -

由于在评论中建议,我跑了其中一些额外的测试,结果似乎缩小可能的问题。

Due to suggestions in the comments, I ran some additional tests, the results of which seem to narrow down the possible issue.

首先,我复制生成的可执行文件到我的Windows 10专业版64位的机器。当在Win 10运行相同的可执行文件,这个问题不是present。

First, I copied the resulting executable to my Windows 10 Pro x64 machine. When running the same executable on Win 10, this issue IS NOT present.

接下来,我编了赢得10专业版64位的机器上,使用VS 2015年的企业。在Win 10下运行时,这个问题不是present。但是,可执行文件复制到我的Win 7的机器仍然显示竖条。

Next, I compiled on the Win 10 Pro x64 machine, using VS 2015 Enterprise. When running in Win 10, this issue IS NOT present. However, copying the executable to my Win 7 machine still displays the vertical bars.

上面的测试让我觉得这是某种直接关系到我使用的OS / .NET版本。

The above test makes me think that this is somehow directly related to the OS/.Net version I am using.

有人认为,这可能是显卡驱动的问题。我有英特尔集成显卡,以及安装在我的机器上的一个专门的NVIDIA显卡。首先,我跑了使用每个GPU。不管我使用的GPU的,其结果是一样的。这使得它成为一个驱动的问题几乎为零的可能性。但是,我还是更新的两个图形驱动程序,就如同另一个数据点。再次,这是没有效果的,并且所述的DateTimePicker仍在显示在我的Windows 7的机器的垂直线。

Someone suggested that this may be a graphics driver issue. I have Intel integrated graphics, as well as a dedicated NVidia graphics card installed on my machine. First, I ran using each GPU. Regardless of which GPU I use, the result is the same. This makes the possibility of it being a driver issue almost zero. However, I still updated both graphics drivers, just as another data point. Again, this had no effect, and the DateTimePicker is still being displayed with vertical lines on my Windows 7 machine.

所以,我的问题仍然存在。已在Windows 7针对.Net框架4.5时,其他人看到的的DateTimePicker,问题临64 SP1?

So, my question still remains. Has anyone else seen issues with the DateTimePicker, when targeting .Net Framework 4.5 on Windows 7 Pro x64 SP1?

推荐答案

显然,这是一个问题的.NET Framework 4.5的Windows 7 64位SP1上运行。当我改变目标框架的.NET Framework 4.5.1,这个问题解决了。我无法解释为什么发生这种情况,但至少有一个解决方法吧。

Apparently this is an issue with .NET Framework 4.5 running on Windows 7 x64 SP1. When I change the target framework to .NET Framework 4.5.1, this issue is resolved. I can't explain why this is happening, but at least there is a work-around for it.

- 编辑 -

我刚刚发现变化框架4.5.1版是不是解决了问题。当我做了改变,Visual Studio会自动添加在的csproj下面的每个属性组:

I just discovered that the change to framework version 4.5.1 isn't what resolved the issue. When I made that change, Visual Studio automatically added the following to each property group in the csproj:

<Prefer32Bit>false</Prefer32Bit>

添加此行到每个配置后,这个问题就解决了​​。我仍然在寻找一个解释,为什么这解决了问题,这样我就可以了解如何避免它在未来。

After adding this line to each configuration, this issue was resolved. I'm still looking for an explanation as to WHY this fixes the issue, so I can understand how to avoid it in the future.

这篇关于.NET的DateTimePicker看起来很奇怪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆