2

I use VB.net

I use ListView to view 50*x thumbnails(.jpg) at the left to the items.

But instead of 32bit high quality thumbnails, ListView lowers them to 8bit or 16bit(not sure).

Here's the code

Private Sub afterprocessed()
    ListView1.Items.Clear()
    Dim imlTemp As New ImageList
    Dim dirFiles() As String = IO.Directory.GetFiles("backend\communicate\thumbnails")
    Dim _imgList As New ImageList
    Dim imgSize As New Size
    imgSize.Width = 50
    ListView1.SmallImageList = _imgList
    Dim count As Integer = 0
    Dim item As New ListViewItem
    For Each dirFile As String In dirFiles
        Dim imgFilename As String = IO.Path.GetFileNameWithoutExtension(dirFile)
        Dim img As New System.Drawing.Bitmap(dirFile)
        Dim imgImage As Image = Image.FromFile(dirFile)
        'Dim imgHeight As Integer
        'imgHeight = imgImage.Height
        imgSize.Height = imgImage.Height
        _imgList.ImageSize = imgSize
        _imgList.Images.Add(img.Clone)
        ListView1.Items.Add(imgFilename, count)
        count += 1
    Next
End Sub

And the quality is noticably low. Compared to original JPG

Any advice? I'd greatly appreciate it :D

4

2 回答 2

1

你需要这个。

this.ListView1.SmallImageList.ColorDepth = ColorDepth.Depth32Bit;
于 2012-12-02T16:21:53.400 回答
0

有一次我遇到了类似的问题,我发现它是由使用该ImageList.ImageSize方法引起的,该方法似乎使用了较差的调整大小算法。我通过确保我使用的所有图像在加载它们之前在磁盘上已经是正确的大小来解决它。但是,如果这不是您的选择,那么在将它们添加到 ImageList之前调整它们 的大小应该不会太难。

于 2012-08-01T11:25:19.587 回答