home *** CD-ROM | disk | FTP | other *** search
/ PC Format Collection 48 / SENT14D.ISO / tech / delphi / disk15 / formcomp.pak / ABOUTDLG.PAS
Encoding:
Pascal/Delphi Source File  |  1995-08-24  |  1.4 KB  |  57 lines

  1. unit AboutDlg;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, About;
  8.  
  9. type
  10.   TAboutBoxDlg = class(TComponent)
  11.   private
  12.     { Private declarations }
  13.     FProductName, FVersion, FCopyright, FComments: string;
  14.   protected
  15.     { Protected declarations }
  16.   public
  17.     { Public declarations }
  18.     function Execute: Boolean;
  19.   published
  20.     { Published declarations }
  21.     property ProductName: string read FProductName write FProductName;
  22.     property Version: string read FVersion write FVersion;
  23.     property Copyright: string read FCopyright write FCopyright;
  24.     property Comments: string read FComments write FComments;
  25.   end;
  26.  
  27. procedure Register;
  28.  
  29. implementation
  30.  
  31. function TAboutBoxDlg.Execute: Boolean;
  32. begin
  33.   AboutBox := TAboutBox.Create(Application);
  34.   try
  35.     if ProductName = '' then ProductName := Application.Title;
  36.     AboutBox.ProductName.Caption := ProductName;
  37.     AboutBox.Version.Caption := Version;
  38.     AboutBox.Copyright.Caption := Copyright;
  39.     AboutBox.Comments.Caption := Comments;
  40.     with AboutBox do
  41.     begin
  42.       Caption := 'About ' + Self.ProductName;
  43.       ProgramIcon.Picture.Graphic := Application.Icon;
  44.       Result := ShowModal = mrOK;
  45.     end;
  46.   finally
  47.     AboutBox.Free;
  48.   end;
  49. end;
  50.  
  51. procedure Register;
  52. begin
  53.   RegisterComponents('Samples', [TAboutBoxDlg]);
  54. end;
  55.  
  56. end.
  57.