Posiblemente se te borra porque dibujas en él y te olvidas. Pero debes hacerlo en su evento OnPaint para que se redibuje cada vez que sea necesario. Aquí está el ejemplo más detallado y ya probado
Código Delphi
[-]
procedure TForm1.PaintBox1Paint(Sender: TObject);
var
N, Y: Integer;
begin
Paintbox1.Canvas.Brush.Color := clWhite;
PaintBox1.Canvas.Brush.Style := bsSolid;
PaintBox1.Canvas.FillRect(PaintBox1.ClientRect);
N := PaintBox1.Height div Espiral.Height;
for Y := 0 to N - 1 do
begin
PaintBox1.Canvas.Draw(0, Y*Espiral.Height, Espiral);
end;
end;
Espiral es un TBitmap que creas al principio:
Código Delphi
[-]
procedure TForm1.FormCreate(Sender: TObject);
begin
Espiral := TBitmap.Create;
Espiral.LoadFromFile('asterisk_orange.bmp');
end;
y destruyes al final:
Código Delphi
[-]
procedure TForm1.FormDestroy(Sender: TObject);
begin
Espiral.Free;
end;
// Saludos