, . , . Paint .
(Gauge), Samples . Gauges.cpp Gauges.h TGauge : \...\CBuilder\Examples\Controls\Source.
Gauges.cpp ( 7.3) , Paint TBitmap. PaintBackground , Color. Kind ForeColor BackColor ( Kind = gkNeedle PaintAsNeedle). CopyMode, ( PaintAsText) ( Draw) .
void _fastcall TGauge::Paint()
{
std::auto_ptr<Graphics::TBitmap> Thelmage
(new Graphics::TBitmap());
std::auto_ptr<TBltBitmap> Overlaylmage (new TBitBitmap());
TRect PaintTRect;
The Image->Height = Height;
TheImage->Width = Width;
PaintBackgroundtThelmage.get());
PaintTRect = ClientRect;
if (FBorderStyle == bsSingle)
InflateRect(&RECT(PaintTRect), -1, -1);
OverlayImage->MakeLike(Thelmage.get());
PaintBackground(Overlay Image.get());
switch(FKind) {
case gkText:
PaintAsNothing(Overlay Image.get(), PaintTRect); break;
case gkHorizontalBar:
case gkVerticalBar:
PaintAsBar(Overlaylmage.get(), PaintTRect); break;
case gkPie:
PaintAsPie(Overlay Image.get(), PaintTRect); break;
case gkNeedle:
PaintAsNeedle(Overlaylmage.get(), PaintTRect); break;
}
The Image->Canvas->CopyMode = cmSrcInvert;
TheImage->Canvas->Draw(0, 0, Overlaylmage.get());
TheImage->Canvas->CopyMode = cmSrcCopy;
if (ShowText == true)
PaintAsText(Thelmage.get(), PaintTRect);
Canvas->CopyMode = cmSrcCopy;
Canvas->Draw(0, 0, Thelmage.get());
}