Graphics::TBitmap * bmp = new Graphics::TBitmap;
// ...
bmp->Canvas->Ellips(0, 0, 10, 10);
Image->Canvas->Draw(0, 0, bmp);
Устранение мерцания
Код:
Все равно мерцает! Расскажите, как все таки правильно?
Код:
TCanvas *PanCan;
HDC PanDC;
PanCan = new TCanvas;
PanDC = GetDC(Panel1->Handle);
PanCan->Handle = PanDC;
BtnCan->Draw(0,0,pBitmap);
HDC PanDC;
PanCan = new TCanvas;
PanDC = GetDC(Panel1->Handle);
PanCan->Handle = PanDC;
BtnCan->Draw(0,0,pBitmap);
Соответственно рисуя на PanCan изображение теперь появляется на Панеле. При желании можно сделать свою кнопку аля BitBtn.
Panel1->DoubleBuffered = true;
Для отслеживания прорисовки и уменьшения мерцания, а также метод Invalidate() для немедленной прорисовки, опять же с уменьшением мерцания. Вот описалово:
Цитата:
Determines whether the control’s image is rendered directly to the window or painted to an in-memory bitmap first.
__property bool DoubleBuffered = {read=FDoubleBuffered, write=FDoubleBuffered, nodefault};
Description
When DoubleBuffered is false, the windowed control paints itself directly to the window. When DoubleBuffered is true, the windowed control paints itself to an in-memory bitmap that is then used to paint the window. Double buffering reduces the amount of flicker when the control repaints, but is more memory intensive.
When a windowed control is a dock site and has an associated dock manager, it must be double-buffered.
Note: Some controls, such as TRichEdit, can’t paint themselves into a bitmap. For such controls, DoubleBuffered must be set to false.
Цитата:
Completely repaint control.
virtual void __fastcall Invalidate(void);
Description
Use Invalidate when the entire control needs to be repainted. When more than one region within the control needs repainting, Invalidate will cause the entire window to be repainted in a single pass, avoiding flicker caused by redundant repaints. There is no performance penalty for calling Invalidate multiple times before the control is actually repainted.
инфа по теме
Хорошая