OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Painting the Gadget

The TGadget class provides two different paint functions: TGadget::PaintBorder and TGadget::Paint.

The PaintBorder function paints the border of the gadget. This virtual function takes a single parameter, a TDC &, and returns void.

PaintBorder implements the standard border styles. If you want to create a new border style, override this function and provide the functionality for the new style. If you want to continue to provide the standard border styles, you should also call the TGadget version of this function. PaintBorder is called by the Paint function.

The Paint function is similar to the TWindow::Paint. This function takes a single parameter, a TDC &, and returns void. Paint is declared virtual. TGadget's PaintGadgets function calls each gadget's Paint function when painting the gadget window. The default Paint function only calls the PaintBorder function. To paint the inner rectangle of the gadget's bounding rectangle, override this function and provide the necessary code.

If you are painting the gadget yourself with the Paint function, you often need to find the area inside the borders and margins of the gadget. This area is called the inner rectangle. You can find the inner rectangle using the TGadget::GetInnerRect function:

void GetInnerRect(TRect& rect);

GetInnerRect places the coordinates of the inner rectangle into the TRect reference passed into it.

See Also