我正在尝试为我的应用程序执行一些自动化测试.测试的一部分是对所选UI控件(主要是PictureBox和Label)进行位图比较.问题在于,对于相同的控件,XP上捕获的位图与Windows 7上捕获的位图不匹配.我需要在两台计算机上都进行测试,但是我不想为每个系统都使用单独的位图.系统或.NET中是否有任何设置可以强制控制在两个系统上的行为相同.还是某些低级问题(例如图形卡驱动程序等).知道如何处理吗?
解决方案可能是由于这些系统的分辨率不同,请检查xp和7中的分辨率是否相同.我有类似的问题,尤其是在Windows XP计算机上渲染动画和某些WPF控件时.自定义控件特别麻烦.但是,在Windows 7环境中运行时,这些问题似乎消失了.据我所知,图形库在XP和Windows 7之间发生了根本性的变化,更不用说WPF将使用GPU渲染图像,这可能会导致旧版本的Windows出现问题. 有关GDI的维基百科
I am trying to implement some automation tests for my application. The part of tests is a bitmap comparison of selected UI controls (mostly PictureBox and Label). The problem is that the bitmap grabbed on XP does not match the bitmap grabbed on Windows 7 for the same control. I would need to run test on both machines, but I don''t want to have a separate bitmaps for each system. Are there any settings in system or .NET to force control to behave same on the both systems. Or is it some low level problem (like graphics card drivers or so). Any idea how to deal with it?
解决方案 It could be due to resolution differences in those systems, check that you have the same resolution in xp and 7.I have had similar issues, particularly with rendering animations and certain WPF controls on a Windows XP machine. Custom controls are especially troublesome. When run in a Windows 7 environment however, these problems seem to disappear. As far as I know the graphics libraries radically changed between XP and Windows 7 not to mention that WPF will render images using the GPU, which may cause problems with older versions of Windows. Wiki atricle on GDI更多推荐
PictureBox拉伸图像在XP和Windows 7上有所不同
发布评论