【问题标题】:imagelist set imagesize doesn't resize subsequently added imagesimagelist set imagesize 不会调整随后添加的图像的大小
【发布时间】:2012-11-02 09:01:26
【问题描述】:

在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 文档,我遵循正确的步骤,首先设置新的图像大小,然后添加图像。

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

【问题讨论】:

    标签: c# winforms listview


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2013-08-26
      • 2016-06-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-07
      • 2020-04-10
      • 2014-06-13
      相关资源
      最近更新 更多