This document is archived and information here might be outdated.  Recommended version.


IDisplay.hDC Property (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Display > ESRI.ArcGIS.Display > Interfaces > ID > IDisplay Interface > IDisplay.hDC Property
ArcGIS Developer Help

IDisplay.hDC Property

The device context that the display is currently drawing to. Only valid between calls to StartDrawing and FinishDrawing.

[Visual Basic .NET]
Public ReadOnly Property hDC As Integer
[C#]
public int hDC {get;}
[C++]
HRESULT get_hDC(
  OLE_HANDLE* hDC
);
[C++]
Parameters
hDC [out, retval]

hDC is a parameter of type OLE_HANDLE*

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks

Returns the device context specified to StartDrawing.  This may be the device context of a display, cache (bitmap), or some other device such as a printer.  As StartDrawing is called frequently throughout the drawing pipeline, the hDc property continually changes and is therefore safe to use only within a single StartDrawing / FinishDrawing block.

This property does not provide a value to pass to IDisplay::StartDrawing. Instead, call IDisplay::StartDrawing with a value of 0 for the hDC as this will automatically use the Windows API function GetDC to populate IScreenDisplay::WindowDC with the hDC of the main display and drawing will occur there.

See Also

IDisplay Interface