home *** CD-ROM | disk | FTP | other *** search
/ Delphi 4 Bible / Delphi_4_Bible_Tom_Swan_IDG_Books_1998.iso / source / Mdidemo2 / Childbmp.pas < prev    next >
Pascal/Delphi Source File  |  1998-03-12  |  1KB  |  57 lines

  1. unit Childbmp;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls,
  7.   Forms, Dialogs, ExtCtrls, Child;
  8.  
  9. type
  10.   TChildBmpForm = class(TChildForm)
  11.     Image1: TImage;
  12.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  13.     procedure FormCreate(Sender: TObject);
  14.   private
  15.     { Private declarations }
  16.   public
  17.     procedure LoadData(const FileName: String); override;
  18.     procedure SaveData(const FileName: String); override;
  19.     { Public declarations }
  20.   end;
  21.  
  22. var
  23.   ChildBmpForm: TChildBmpForm;
  24.  
  25. implementation
  26.  
  27. {$R *.DFM}
  28.  
  29. procedure TChildBmpForm.FormClose(Sender: TObject;
  30.   var Action: TCloseAction);
  31. begin
  32.   Action := caFree;
  33. end;
  34.  
  35. procedure TChildBmpForm.LoadData(const FileName: String);
  36. begin
  37.   Image1.Picture.LoadFromFile(FileName);
  38.   Caption := LowerCase(FileName);
  39. end;
  40.  
  41. procedure TChildBmpForm.SaveData(const FileName: String);
  42. begin
  43.   Image1.Picture.SaveToFile(FileName);
  44.   Caption := LowerCase(FileName);
  45. end;
  46.  
  47. { This procedure frees the ancestor child form class's
  48.   Memo1 object, which would otherwise conflict with
  49.   the subclassed window's Image1 object. }
  50. procedure TChildBmpForm.FormCreate(Sender: TObject);
  51. begin
  52.   inherited;
  53.   Memo1.Free;
  54. end;
  55.  
  56. end.
  57.