Untitled
public text v1 · immutable
Bitmap myBitmap = null;
void OnPaint(...)
{
if (myBitmap == null)
{
// create bitmap and draw to it
}
// copy bitmap to e.graphics
}
void SomethingThatInvalidates()
{
// if for some reason your bitmap needs to change...
myBitmap.Dispose();
myBitmap = null;
}