Deleting TextOnPic lazarus / 39-Graphics ---------------------------------------------------------------------- Profi_Noob · 2021-02-21 20:31 Hey there. My program includes a highscore list. Since I want a transparent background, I'm using the TextOnPic code from https://forum.lazarus.freepascal.org/index.php?topic=38143.0 Now the problem. The txt that contains the data can get extended if a new highscore is made. But if I go back to the highscore list without restarting the program, the old list get's overlaid with the updated list. Is there a way to delete the previous list or a better way to display the highscores? Greetings ---------------------------------------------------------------------- speter · 2021-02-22 00:42 If you are drawing on a canvas (like a tpaintbox) I think you could include another paintbox on top of the first - draw the highscore material on the "upper" canvas - and redraw that canvas if the scores change. Similar to the layers in a paint program... I also think you could use this idea if the main canvas is on an image. cheers S. ---------------------------------------------------------------------- Handoko · 2021-02-22 01:26 Quote from: Profi_Noob on February 21, 2021, 09:31:44 pmSince I want a transparent background, I'm using the TextOnPic ... The TextOnPic basically is just a TImage and a TLabel. You don't need to use it, instead you can just drop a TImage and then a TLabel above it. So you can change the text whenever you like. You cannot change the text using TextOnPic because it will create a new TLabel every time you call the function. Alternatively, you can draw on the canvas directly. Not too hard but you need to code everything yourself. But you can have more control about it. I'm not fully sure what you want, but if you want to have some change- able text above an image, try this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, ExtCtrls, StdCtrls; type   { TForm1 }   TForm1 = class(TForm)    Button1: TButton;    Image1: TImage;    Label1: TLabel;    Timer1: TTimer;    procedure Button1Click(Sender: TObject);    procedure FormCreate(Sender: TObject);    procedure Timer1Timer(Sender: TObject);  end; var  Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.Button1Click(Sender: TObject);const  PictureAlreadyLoaded: Boolean = False;begin  if not(PictureAlreadyLoaded) then  begin    Image1.Picture.LoadFromFile('project1.ico');    PictureAlreadyLoaded := True;  end;  Timer1.Enabled := not(Timer1.Enabled);  Label1.Visible := True;end; procedure TForm1.FormCreate(Sender: TObject);begin  Timer1.Enabled    := False;  Timer1.Interval   := 30;  Label1.Font.Size  := 25;  Label1.Font.Color := clWhite;  Label1.Visible    := False;end; procedure TForm1.Timer1Timer(Sender: TObject);const  XDirection: Integer = 1;begin  Label1.Caption := TimeToStr(Now);  case XDirection > 0 of    True:  if (Label1.Left+150) > Width then XDirection := -1;    False: if Label1.Left < 20 then XDirection := 1;  end;  Label1.Left := Label1.Left + XDirection;end; end.