Dynamically showing the version in the about box

This commit is contained in:
Nikolaos Georgiou 2021-10-29 07:57:16 +02:00
parent 90991c865d
commit af4fd0bee2
2 changed files with 21 additions and 1 deletions

View File

@ -10,6 +10,7 @@ object AboutBox: TAboutBox
Font.Color = clWindowText
Font.Height = -14
Font.Name = 'Tahoma'
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '2.0.6.0'
object Panel1: TPanel

View File

@ -5,9 +5,12 @@ unit about1;
interface
uses SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
Buttons, ExtCtrls;
Buttons, ExtCtrls, fileinfo;
type
{ TAboutBox }
TAboutBox = class(TForm)
Panel1: TPanel;
ProductName: TLabel;
@ -15,6 +18,7 @@ type
Copyright: TLabel;
Comments: TLabel;
OKButton: TButton;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
@ -28,5 +32,20 @@ implementation
{$R *.lfm}
{ TAboutBox }
procedure TAboutBox.FormCreate(Sender: TObject);
var
FileVerInfo: TFileVersionInfo;
begin
FileVerInfo := TFileVersionInfo.Create(nil);
try
FileVerInfo.ReadFileInfo;
Version.Caption := 'Version ' + FileVerInfo.VersionStrings.Values['FileVersion'];
finally
FileVerInfo.Free;
end;
end;
end.