Re: PaintBox image trouble




"Rob Kennedy" <me3@xxxxxxxxxxx> wrote in message news:3ps2s7FbubeeU1@xxxxxxxxxxxxxxxxx


If the calculations are lengthy, but they don't change often, then you can paint the image once to a TBitmap, and then in your OnPaint handler, just use Canvas.Draw(Bitmap, 0, 0) to copy the pre-drawn bitmap onto the screen.

Ok: Moon :TBitmap; s1, s2 :string;

Procedure TForm.FormShow;
begin
    CountMoon(s1, s2);
    Moon := TBitmap.Create;
    DrawMoon(s1, s2);
end;

Procedure TForm.DrawMoon(s1,s2 :string);
begin
 with Moon do begin
    {set moon image dimensions}
 end;
 with Moon.Canvas do begin
     {draw it}
 end;
end;

Procedure TForm.?????????(Sender: TObject); {with which OnPaint handler? No PaintBox any more}
begin
Canvas.Draw(Moon, 0, 0); {this will end in 'incompatible types' }
end;


.