BufferedGraphicsContext.MaximumBuffer Property

Definition

Gets or sets the maximum size of the buffer to use.

C#
public System.Drawing.Size MaximumBuffer { get; set; }

Property Value

A Size indicating the maximum size of the buffer dimensions.

Exceptions

The height or width of the size is less than or equal to zero.

Examples

The following example demonstrates setting the maximum size for the buffer for a BufferedGraphicsContext. This code is part of a larger example provided for the BufferedGraphics class.

C#
// Sets the maximum size for the graphics buffer
// of the buffered graphics context. Any allocation
// requests for a buffer larger than this will create
// a temporary buffered graphics context to host
// the graphics buffer.
appDomainBufferedGraphicsContext.MaximumBuffer = new Size(400, 400);

Remarks

This property allows you to get or set the maximum dimensions for a buffer that should be retained in memory. You can allocate a buffer of any size, however any buffer with dimensions greater than the MaximumBuffer size will be used temporarily and then discarded when the BufferedGraphics object is released.

Applies to

产品 版本
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

See also