How to: Manually Manage Buffered Graphics
For more advanced double buffering scenarios, you can use the .NET Framework classes to implement your own double-buffering logic. The class responsible for allocating and managing individual graphics buffers is the BufferedGraphicsContext class. Every application has its own default BufferedGraphicsContext that manages all of the default double buffering for that application. You can retrieve a reference to this instance by calling the Current.
Set the Current property, as shown in the following code example.
You do not need to call the
Disposemethod on the BufferedGraphicsContext reference that you receive from the BufferedGraphicsManager class. The BufferedGraphicsManager handles all of the memory allocation and distribution for default BufferedGraphicsContext instances.
For graphically intensive applications such as animation, you can sometimes improve performance by using a dedicated BufferedGraphicsContext instead of the BufferedGraphicsContext provided by the BufferedGraphicsManager. This enables you to create and manage graphics buffers individually, without incurring the performance overhead of managing all the other buffered graphics associated with your application, though the memory consumed by the application will be greater.
Declare and create a new instance of the BufferedGraphicsContext class, as shown in the following code example.