OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Device-context functions

The device-context functions are used to access information about the device context (DC) itself.

They are equivalent to the Windows API functions of the same names.

You can save and restore a device context much as you would with the Windows API by using the functions TDC::SaveDC and TDC::RestoreDC. The following code sample shows how these functions might be used. Notice that RestoreDC's single parameter uses a default value instead of specifying the int parameter:

void TMyDC::SomeFunc(TDC& dc, int x1, int y1, int x2, int y2)
{
dc.SaveDC();
dc.SetMapMode(MM_LOENGLISH);
.
.
.
dc.Rectangle(x1, -y1, x2, -y2);
dc.RestoreDC();
}

You can also reset a device context to the settings contained in a DEVMODE structure using the TDC::ResetDC function. The only parameter ResetDC takes is a reference to a DEVMODE structure.

You can use the TDC::GetDeviceCaps function to retrieve device-specific information about a given display device. This function takes one parameter, an int index to the type of information to retrieve from the device context. The possible values for this parameter are the same as for the Windows API function.

You can use the TDC::GetDCOrg function to locate the current device context's logical coordinates within the display device's absolute physical coordinates. This function takes a reference to a TPoint structure and returns a bool. The bool indicates whether the function call was successful, and the TPoint object contains the coordinates of the device context's translation origin.

See Also