Surface.GetGraphics Method

Language:

Retrieves a device context.

Definition

Visual Basic Public Function GetGraphics() As Graphics
C# public Graphics GetGraphics();
C++ public:
GraphicsGetGraphics();
JScript public function GetGraphics() : Graphics;

Return Value

System.Drawing.Graphics
A Graphics Leave Site object that represents the device context for the surface.

Remarks

The following restrictions apply.

When a device context is outstanding on a surface, the application cannot call the following methods.

The GetGraphics method causes an implicit lock; do not retain the device context for later use. Call Surface.ReleaseGraphics to release it.

It is valid to call Surface.GetGraphics and Surface.ReleaseGraphics on levels of a mipmap or cube map; however, these calls are slow to all mip levels except the topmost level, and GDI operations to these mip levels are not accelerated.

The Graphics Leave Site object provides access to Microsoft Win32 and GDI functionality.

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

See Also


Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.

Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center