All pastes #639558 Raw Edit

Untitled

public text v1 · immutable
#639558 ·published 2007-07-30 17:38 UTC
rendered paste body

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;
}