The following methods are used to retrieve and release a device context (DC).
A device context (DC) is associated with a dialog or dialog control, and is a drawing area managed by a dialog or dialog control. It stores information about graphic objects (such as bitmaps, lines, and pixels that are displayed) and the tools (such as pens, brushes, and fonts) that are used to display them.
>>-aDialogControl~GetDC----------------------------------------><
The GetDC method reserves drawing resources and returns the handle to the display device context of a dialog or dialog control.
The handle to the device context, or 0 if this method failed.
The following example retrieves the device context of button DRAWINGS, processes the drawing commands, and frees the device context resources:
obj = MyDialog~GetButtonControl("DRAWINGS") if obj = .Nil then return -1 dc = obj~GetDC if dc = 0 then return -1 ... /* draw something */ obj~FreeDC(dc)
Note: When you have finished with the device context, call FreeDC.
>>-aDialogControl~FreeDC(--dc--)-------------------------------><
The FreeDC method releases the device context resources that were reserved for GetDC.
The only argument is:
The handle to the device context that is to be released.
The device context resources were released.
Releasing the device context resources failed.
See GetDC for an example.
Note: Always call this method when you have finished with the device context.