I have a large TIFF picture (5.9 MB, 13k X 16k resolution) that the user loads into a scrollable panel that he then can zoom in/out of, scroll and mark points, regions etc. on.<
Is not tested, but should give an idea.
Bitmap _cached = null;
override void OnPaint(PaintEventArgs e)
{
if(_cached == null)
{
_cached = new Bitmap(this.ClientSize.Width, this.ClientSize.Height);
using(var graphics = Graphics.FromImage(_cached)
{
// draw into this graphics once -> it will be cached in _cached bitmap
}
}
e.Graphics.DrawImage(_cached, Point.Empty);
}
// call this if _zoom or ClientSize is changed
void ResetCache()
{
_cache = null;
this.Invalidate(); // mandatory for _zoom change
}
Also, I don't know how to do you present your zoomed-in picture, but usually there is an offset so that you can move (pan) image.