Assembly: System.Drawing (in system.drawing.dll)
The BufferedGraphicsContext class allows you to implement custom double buffering for your graphics. Graphics that use double buffering can reduce or eliminate flicker that is caused by redrawing a display surface.
The simplest way to use double buffering is to set the OptimizedDoubleBuffer control style flag on a control using the SetStyle method. Setting the OptimizedDoubleBuffer control styles flag for a control redirects all painting for the control through a default graphics buffer, without requiring any additional code. This flag is set to true by default.
The BufferedGraphicsContext class provides methods for creating and configuring a graphics buffer. The Allocate method creates a BufferedGraphics, which is a wrapper for a graphics buffer that also provides methods you can use to write to the buffer and render its contents to an output device.
You can retrieve the BufferedGraphicsContext for the current application domain from the static BufferedGraphicsManager.Current property. For graphically intensive applications such as animation, you can create a dedicated BufferedGraphicsContext using the constructor, but for most applications the BufferedGraphicsManager.Current property will be sufficient.
The following code example demonstrates how to acquire the BufferedGraphicsContext for the current application domain. This code is part of a larger example provided for the BufferedGraphics class.
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.