Share via


Surface.LockRectangle Method ()

Locks a rectangle on a surface.

Overload List

public GraphicsStream LockRectangle(LockFlags);
public GraphicsStream LockRectangle(LockFlags, out int);
public GraphicsStream LockRectangle(Rectangle, LockFlags);
public GraphicsStream LockRectangle(Rectangle, LockFlags, out int);
public Array LockRectangle(Type, LockFlags, out int, int[]);
public Array LockRectangle(Type, LockFlags, int[]);
public Array LockRectangle(Type, Rectangle, LockFlags, out int, int[]);
public Array LockRectangle(Type, Rectangle, LockFlags, int[]);

Remarks

If LockFlags.DoNotWait is specified and the driver cannot lock the surface immediately, Surface.LockRectangle throws WasStillDrawingException so that an application can use the CPU cycles while waiting for the driver to lock the surface.

The only lockable format for a depth-stencil surface is Format.D16Lockable.

For performance reasons, dirty regions are recorded only for level zero of a texture. Dirty regions are automatically recorded when Surface.LockRectangle is called without LockFlags.NoDirtyUpdate or LockFlags.ReadOnly. For more information, see Device.UpdateTexture.

A multisample back buffer cannot be locked.

Exceptions

InvalidCallException

The method call is invalid. For example, a method's parameter might contain an invalid value.

See Also