OWLNext 7.0
Borland's Object Windows Library for the modern age
|
Graphics objects that you can select into a device context normally exist as logical objects, which contain the information required for the creation of the object.
The graphics objects are connected to the logical objects through a Windows handle. When the graphics object is selected into the device context, a physical tool (created using the attributes contained in the logical pen) is created inside the device context.
You can also select a stock object using the function TDC::SelectStockObject. SelectStockObject takes one parameter, an int that is equivalent to the parameter used to call the API function GetStockObject. Essentially the SelectStockObject function takes the place of two calls: a call to GetStockObject to actually get a stock object, then a call to SelectObject to place the stock object into the device context.
TDC provides functions to restore original objects in a device context. There are normally four versions of this function, TDC::RestoreBrush, TDC::RestorePen, TDC::RestoreFont, and TDC::RestorePalette. A fifth, TDC::RestoreTextBrush, exists only for 32-bit applications. The TDC::RestoreObjects function calls all four functions (or five, under 32 bits), and restores all original objects in the device context. All of these functions return void and take no parameters.
TDC::GetBrushOrg takes one parameter, a reference to a TPoint object. It places the coordinates of the brush origin into the TPoint object. GetBrushOrg returns true if the operation was successful.
TDC::SetBrushOrg takes two parameters, a reference to a TPoint object and a TPoint *, and sets the device context's brush origin to the x and y values in the first TPoint object. If you do not specify a value for the second parameter, it defaults to 0. If you do pass a pointer to a TPoint object as the second parameter, SetBrushOrg places the old values for the brush origin into the x and y members of the object. The return value indicates whether the operation was successful.