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

IScreenDisplay2.WindowDC Property (ArcObjects .NET 10.7 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Display > ESRI.ArcGIS.Display > Interfaces > IS > IScreenDisplay2 Interface > IScreenDisplay2.WindowDC Property
ArcGIS Developer Help

IScreenDisplay2.WindowDC Property

Device context for the associated window. Only use this between calls to StartDrawing and FinishDrawing.

[Visual Basic .NET]
Public ReadOnly Property WindowDC As Integer
public int WindowDC {get;}
HRESULT get_WindowDC(
hDC [out, retval]

hDC is a parameter of type OLE_HANDLE*

Product Availability

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


This property is a Windows operating environment device context handle. The Windows operating environment manages the system display by assigning a device context for each window in the application. You can use the WindowDC property to refer to the handle for an object's device context.

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 IScreenDisplay2::WindowDC with the hDC of the main display and drawing will occur there.

The value of the WindowDC property can change while an application runs, so do not store the value in a variable; instead, use the WindowDC property each time you need it.

See Also

IScreenDisplay2 Interface