Export (0) Print
Expand All
Expand Minimize

Visual Basic Reference

Visual Studio 6.0

HasDC Property

See Also    Example    Applies To

Returns or sets a value that determines whether a unique display context (or hDC) is allocated to a control.


object.HasDC [ = boolean]

The HasDC property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
boolean A Boolean expression that specifies whether an hDC is allocated to a control.


The settings for boolean are:

Setting Description
True (Default) An hDC is allocated to the control.
False No hDC is allocated to the control.


If you set the HasDC property to False, you should copy the hDC of the control only into a local variable. Calling APIs with an hDC obtained outside of the scope of an event can cause crashes or other unpredictable results.

For windowless UserControls, the HasDC property will only take effect if the UserControl is created with a window (i.e., it's in a container that doesn't support windowless activation, such as Visual Basic version 4.0 or Internet Explorer version 3.0). Windowless UserControls that are activated windowless never have their own hDC, and therefore ignore the value of their HasDC property.

© 2014 Microsoft