Hi guys. I am using a UserControl to load a .tif file on it. After that I am using the GDI API to draw lines and rectangles on top of the Image loaded into the UserControl. So far that is working fine. But the thing is, when ever I draw a new Rectangle/Line on on the UserControl, the UserControl is Invalidated and is repainted. The Rectangles/Lines should be redrawn and that is the case. But the Image need not be redrawn again. For one thing, the Image doesn't change once it is loaded. Second, the size of the image is well above 100MB so repainting it every time I call Invalidate() is making my application slow.
I know there is a way to make OnPaint() to paint only the specific part of the UserControl but the thing is, the TIF image and the other shapes are drawn on the same area. i.e the image is drawn first and on top of it the shapes. It is like there is a layering. What I am trying to do is to force Invalidate() to repaint only the shapes on the upper layer without going all the way to down to the image. As far as I know GDI doesn't have a 'Z' coordinate like that in OpenGL. Which means, I won't be able to tell my application not to repaint the image.
So, if you know a workaround to this problem, I would greatly appreciate it.
Thanks in advance