View large multi page Tif images within 100 milliseconds

后端 未结 4 1737
悲&欢浪女
悲&欢浪女 2021-01-02 03:42

I\'m using WinForms. Inside my form I have a pictureBox (set to normal mode), next and previous button. I want to resize and load Multipage TIF ima

4条回答
  •  梦谈多话
    2021-01-02 04:31

    You might have an advantage in creating your own PictureBox that inherits from the original. You can override the OnPaint and tweak the following parameters of the passed Graphics object:

    private override OnPaint(object sender, PaintEventArgs e)
    {
        e.Graphics.CompositingQuality = CompositingQuality.HighSpeed;
        e.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
        e.Graphics.SmoothingMode = SmoothingMode.None;
        e.Graphics.PixelOffsetMode = PixelOffsetMode.Half;
        e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
        e.Graphics.CompositingMode = CompositingMode.SourceCopy;
        base OnPaint(sender, e)
    }
    

    Some of these parameters have a huge impact on the rendering speed (and to the quality of the result).

    The parameters used in the code example are already quite fast but maybe you find better combinations for your requirements.

提交回复
热议问题