Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# imagelist设置imagesize不';t调整随后添加的图像的大小_C#_Winforms_Listview - Fatal编程技术网

C# imagelist设置imagesize不';t调整随后添加的图像的大小

C# imagelist设置imagesize不';t调整随后添加的图像的大小,c#,winforms,listview,C#,Winforms,Listview,在调整CurrentImages中显示的图像大小的功能中,图像突然之间(仅在本生产版本中,而不是在以前的测试版本中)似乎无法缩放 相反,它们被剪掉了 private void ResizeCurrentImages(double zoom) { foreach (Image image in this.CurrentImages.Images) { image.Dispose(); } this.CurrentImages.Images.Clea

在调整
CurrentImages
中显示的图像大小的功能中,图像突然之间(仅在本生产版本中,而不是在以前的测试版本中)似乎无法缩放

相反,它们被剪掉了

private void ResizeCurrentImages(double zoom)
{
    foreach (Image image in this.CurrentImages.Images)
    {
        image.Dispose();
    }

    this.CurrentImages.Images.Clear();
    this.CurrentImages.ImageSize = new Size((int)Math.Floor(this.MAX_WIDTH * zoom), (int)Math.Floor(this.MAX_HEIGHT * zoom));    

    foreach (Image image in this.OriginalImages.Images)
    {
        this.CurrentImages.Images.Add(image);
    }
}
其中
MAX_WIDTH=161
MAX_HEIGHT=256

根据MSDN文档,我遵循正确的步骤,首先设置新的imagesize,然后添加图像


以前有没有其他人遇到过这个问题?

结果是错误出现在代码的其他地方。还有一个部分更改图像,它使用原始大小而不是缩放大小创建位图