当显示在 Button
或 ListView
上时,32 位 ImageList
中的 32 位图像无法正确显示。图片边缘有一些黑色半透明像素(像PNG一样有Alpha通道)。
此外,图片会被损坏,并且质量会因图片上的线条而降低(例如,当您调整图片大小而不重新采样时)。
插入的图像具有 32 位质量,并且与 ImageList
图像具有相同的尺寸。
我尝试使用 Resources files
将相同的图像放在 Button
上,这可行,但对于 ListView
,我必须使用 ImageList< /code> ——效果不佳。
是否存在与 32 位 ImageList
相关的内存泄漏或已知问题?
When displayed either on Button
or on ListView
, 32-bit images in a 32-bit ImageList
are not displayed correctly. There are some black translucent pixels on the edge of the pictures (which have Alpha channel like PNG).
Also, pictures are damaged and quality is downgraded with lines over them (like when you resize a picture without resampling it).
Inserted images are in 32-bit quality and have same dimensions as ImageList
images.
I tried to put same images on Button
by using Resources files
and that works, but for ListView
, I have to use ImageList
-- which don't works well.
Is there memory leaks or known issues related to 32-bit ImageList
?
发布评论
评论(2)
仅当您导入(32 位 16x16)ICO 文件时才会出现此问题。如果导入 32 位 16x16 PNG 文件,则没有问题。
现在你知道了!
This problem only happens when you import (32-bit 16x16) ICO file. If you import a 32-bit 16x16 PNG file, there is no issue.
Now you known!
我同意 Velcro 的评论..似乎是 32 位 System.Drawing dll 的问题。
我遇到了同样的问题(32 位系统上的缩略图质量很糟糕),结果发现这不是
Listview
控件,而是我们的缩略图生成。我们放入了此 调整图像大小- asp-net-without-loss-the-image-quality 并且效果非常好!我将此归因于 System.Drawing 的问题,因为我们最初让列表视图为我们进行缩放。我们解决该问题的第二次尝试是使用开源 ImageListView 控件。这也有完全相同的问题,它仍然使用 System.Drawing 来生成拇指。
然后,我们尝试以通用方式手动生成拇指(仍然使用 System.Drawing),但它仍然损坏。最后决定使用调整大小的选项(上述解决方案)并解决了这个问题。
I'm with the comment by Velcro..seems to be a problem with the 32 bit System.Drawing dll.
I had the same issue (terrible thumbnail quality on 32 bit systems), and it turned out that it wasn't the
Listview
control, but with our thumbNail generation. We dropped in the code provided in this SO answer: resizing-an-image-in-asp-net-without-losing-the-image-quality and it worked great!I'm attributing this to a problem with System.Drawing because we were initially letting the listview do the scaling for us. Our second attempt at fixing the problem was using the open source ImageListView control. That also had the exact same problem and it still uses System.Drawing to generate the thumbs.
We then tried manually generating thumbs in a generic manner (still with System.Drawing) and it was still broken. Finally decided to play with the options for resizing (the above solution) and that solved it.