Share via


Surface.GetGraphics Method

Retrieves a device context.

Namespace: Microsoft.WindowsMobile.DirectX.Direct3D
Assembly: Microsoft.WindowsMobile.DirectX (in microsoft.windowsmobile.directx.dll)

Syntax

'Declaration
Public Function GetGraphics As Graphics
'Usage
Dim instance As Surface
Dim returnValue As Graphics

returnValue = instance.GetGraphics
public Graphics GetGraphics ()
public:
Graphics^ GetGraphics ()
public Graphics GetGraphics ()
public function GetGraphics () : Graphics
Not applicable.

Return Value

A Graphics object that represents the device context for the surface.

Exceptions

Exception type Condition

InvalidCallException

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

Remarks

The following restrictions apply.

This method is valid only on the following Format formats: R5G6B5, X1R5G5B5, R8G8B8, and X8R8G8B8. Formats that contain alpha are not supported because the Microsoft Windows Graphics Device Interface (GDI) implementations do not have a well-defined behavior on the alpha channel.

Only one device context per surface can be returned at a time.

This method fails if the surface is already locked. It also fails if the surface is a member of a mipmap or cube map, and any other mipmap or cube map member is locked.

This method fails on render targets unless they were created as lockable (or, in the case of back buffers, with LockableBackBuffer of a PresentFlag).

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

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

It is valid to call this method and 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 object provides access to Microsoft Win32 and GDI functionality.

Platforms

Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Compact Framework

Supported in: 2.0

See Also

Reference

Surface Class
Surface Members
Microsoft.WindowsMobile.DirectX.Direct3D Namespace