home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 6 / mastvb6.iso / leadtools / ocx32.lt / ABOUT.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-07-03  |  2.8 KB  |  101 lines

  1. unit About;
  2.  
  3. interface
  4.  
  5. uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, StdCtrls,
  6.   Buttons, ExtCtrls, SysUtils, OleCtrls, LEAD, LEADDef;
  7.  
  8. type
  9.   TAboutBox = class(TForm)
  10.     Panel1: TPanel;
  11.     ProgramIcon: TImage;
  12.     Label1: TLabel;
  13.     Label2: TLabel;
  14.     Label3: TLabel;
  15.     GroupBox1: TGroupBox;
  16.     Product: TLabel;
  17.     Level: TLabel;
  18.     Version: TLabel;
  19.     BDate: TLabel;
  20.     BTime: TLabel;
  21.     LeadCtrl1: TLeadCtrl;
  22.     procedure FormCreate(Sender: TObject);
  23.     procedure FormShow(Sender: TObject);
  24.   private
  25.     { Private declarations }
  26.     bImageLoaded: bool;
  27.   public
  28.     { Public declarations }
  29.   end;
  30.  
  31. var
  32.   AboutBox: TAboutBox;
  33.  
  34. implementation
  35.  
  36. {$R *.DFM}
  37.  
  38. procedure TAboutBox.FormCreate(Sender: TObject);
  39. var
  40.    S : String;
  41. begin
  42.    {get the version info from the LEAD OCX}
  43.    Product.Caption:=LeadCtrl1.VersionProduct;
  44.    BDate.Caption:=LeadCtrl1.VersionDate;
  45.    BTime.Caption:=LeadCtrl1.VersionTime;
  46.    If (LeadCtrl1.VersionLevel = VERSIONLEVEL_EXP) then
  47.       Level.Caption:='Express'
  48.    else If (LeadCtrl1.VersionLevel = VERSIONLEVEL_MEDICAL) then
  49.       Level.Caption:='Medical Express'
  50.    else
  51.       Level.Caption:='Professional';
  52.    Str(LeadCtrl1.VersionMajor, S);
  53.    Version.Caption:=S;
  54.    Str(LeadCtrl1.VersionMinor, S);
  55.    Version.Caption:=Version.Caption + '.';
  56.    Version.Caption:=Version.Caption + S;
  57.  
  58.    { Load the image when you are about to show the ABout form }
  59.    bImageLoaded := False;
  60. end;
  61.  
  62. procedure TAboutBox.FormShow(Sender: TObject);
  63. var
  64.    nRet, nWidth, nHeight : integer;
  65.    rWidth, rHeight : real;
  66. begin
  67.    {load an image called image1.cmp and display it as a Glyph}
  68.    {note, this image is in the images subdir of the LEADTOOLS}
  69.    {install dir.  Also, if you change dirs and then open this}
  70.    {dialog, Load will fail and no image will be used.}
  71.    if bImageLoaded = false then
  72.    begin
  73.       bImageLoaded := true;
  74.       LeadCtrl1.EnableMethodErrors := False;
  75.       Screen.Cursor := crHourglass;
  76.       nRet:=LeadCtrl1.Load('..\..\..\..\images\image1.cmp', 0, 0, 1);
  77.       if (nRet = 0) then
  78.       begin
  79.          { resize the image to fit the OCX, and maintain aspect ratio }
  80.          if (LeadCtrl1.BitmapWidth>LeadCtrl1.BitmapHeight) then
  81.          Begin
  82.             nWidth:=LeadCtrl1.Width;
  83.             rHeight:=nWidth * (LeadCtrl1.BitmapHeight / LeadCtrl1.BitmapWidth);
  84.             nHeight:=Round(rHeight);
  85.             LeadCtrl1.Size(nWidth, nHeight, RESIZE_RESAMPLE);
  86.          end
  87.          else
  88.          Begin
  89.             nHeight:=LeadCtrl1.Height;
  90.             rWidth:=nHeight * (LeadCtrl1.BitmapWidth / LeadCtrl1.BitmapHeight);
  91.             nWidth:=Round(rWidth);
  92.             nRet:=LeadCtrl1.Size(nWidth, nHeight, RESIZE_RESAMPLE);
  93.          end;
  94.       end;
  95.       Screen.Cursor := crDefault;
  96.    end;
  97. end;
  98.  
  99. end.
  100.  
  101.