WinForms 应用程序中 ListView 上的 .NET 图像问题(显示不正确)

发布于 2024-10-02 09:51:48 字数 681 浏览 1 评论 0原文

我在图像方面遇到了非常奇怪的问题。我有一个设置窗口,左侧有一个 ListView,其中有各种图像图标,单击这些图标时会更新右侧面板以显示相关内容 - 没有什么特别的。

然而,我最近添加了两个额外的图标,但它们的图像没有正确显示,我无法弄清楚为什么。我尝试了各种不同的图像格式(png、jpg、gif、bmp),但它们都无法正确显示。我在另一台计算机上尝试过,看看是否是我安装的 .NET,但错误仍然存​​在。

如果每个图像都显示不正确,我会很高兴,但不幸的是只有这两个图像,也许还有我现在添加的任何其他图像。

有没有人有任何想法 - 我完全没有想法...

这是它运行时的样子...

 alt text

这是与 Visual Studio 中显示的相同的资源文件...

alt text

另一个...

alt text

其他图像渲染得很好,比如这个...

替代文字

I am experiencing very weird issues surrounding Images. I have a settings window, which has a ListView on the left hand side which has various image icons which when clicked update the panel to the right to display relevant stuff - nothing hugely special.

However, I have recently added two extra icons, but their images are not being displayed correctly and I can't for the life of me figure out why. I've tried various different image formats (png, jpg, gif, bmp) and none of them display correctly. I've tried it on another computer to see if it was my installation of .NET but the error persisted.

I'd be happy if every image displayed incorrectly, but unfortunately its just these two, and perhaps any other image I add now.

Has anyone got any ideas - I'm all out of them...

Here is what it looks like when it runs...

alt text

Here is the same resource file as shown in visual studio...

alt text

The other one...

alt text

The other images render absolutely fine, such as this one...

alt text

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倾`听者〃 2024-10-09 09:51:48

这是由存储这些图像的ImageList 引起的。您已将 ColorDepth 属性保留为默认值 Depth8Bit。这迫使 Windows 将这些具有高颜色内容的图像(例如,请注意箭头中的微妙渐变)转换为只能存储 256 种不同颜色的像素格式。这是一种有损转换并会导致伪影。

将属性更改为 Depth32Bit。

This is caused by the ImageList that stores these images. You've left the ColorDepth property to the default, Depth8Bit. Which forces Windows to convert these images with high color content (note the subtle gradient in the arrows for example) to a pixel format that can store only 256 distinct colors. That's a lossy conversion and causes artifacts.

Change the property to Depth32Bit.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文