Share via


Surface.GetGraphics Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

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()
member GetGraphics : unit -> Graphics 

Return Value

Type: System.Drawing.Graphics
A Graphics object that represents the device context for the surface.

Exceptions

Exception 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.

.NET Framework Security

Platforms

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

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Compact Framework

Supported in: 3.5, 2.0

See Also

Reference

Surface Class

Surface Members

Microsoft.WindowsMobile.DirectX.Direct3D Namespace