Since 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:
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.