Changeset 18 for trunk/UMainForm.pas


Ignore:
Timestamp:
Sep 27, 2011, 3:49:24 PM (13 years ago)
Author:
george
Message:
  • Added: Persistent window position and size stored to registry.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UMainForm.pas

    r16 r18  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
    9   ComCtrls, Menus, ActnList, UCore, UPlatform, Math, DateUtils, GraphType;
     9  ComCtrls, Menus, ActnList, UCore, UPlatform, Math, DateUtils, GraphType,
     10  UPersistentForm, UApplicationInfo;
    1011
    1112type
     
    3940    procedure AShowMapExecute(Sender: TObject);
    4041    procedure AShowRawImageDescExecute(Sender: TObject);
     42    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    4143    procedure FormCreate(Sender: TObject);
    4244    procedure FormDeactivate(Sender: TObject);
     45    procedure FormDestroy(Sender: TObject);
    4346    procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    4447    procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
     
    5558    Drawing: Boolean;
    5659  public
    57     { public declarations }
     60    PersistentForm: TPersistentForm;
    5861  end;
    5962
     
    9699procedure TMainForm.FormCreate(Sender: TObject);
    97100begin
     101  PersistentForm := TPersistentForm.Create;
     102  PersistentForm.RegistryKey := '\Software\' + ApplicationInfo.CompanyName + '\' + ApplicationInfo.Name;
     103
    98104  Application.OnDeactivate := FormDeactivate;
    99105  Randomize;
     
    138144begin
    139145  Engine.KeyBoard.ClearAll;
     146end;
     147
     148procedure TMainForm.FormDestroy(Sender: TObject);
     149begin
     150  PersistentForm.Free;
    140151end;
    141152
     
    178189
    179190procedure TMainForm.AShowRawImageDescExecute(Sender: TObject);
    180 var
    181   List: TStringList;
    182 begin
    183   with Image1.Picture.Bitmap.RawImage, Description do
    184   try
    185     List := TStringList.Create;
    186     with List do begin
    187       Add('Format: ' + RawImageColorFormatNames[Format]);
    188       Add('Width: ' + IntToStr(Width));
    189       Add('Height: ' + IntToStr(Height));
    190       Add('Depth: ' + IntToStr(Depth));
    191       Add('BitOrder: ' + RawImageBitOrderNames[BitOrder]);
    192       Add('ByteOrder: ' + RawImageByteOrderNames[ByteOrder]);
    193       Add('LineOrder: ' + RawImageLineOrderNames[LineOrder]);
    194       Add('LineEnd: ' + RawImageLineEndNames[LineEnd]);
    195       Add('BitsPerPixel: ' + IntToStr(BitsPerPixel));
    196       Add('RedPrec: ' + IntToStr(RedPrec));
    197       Add('RedShift: ' + IntToStr(RedShift));
    198       Add('GreenPrec: ' + IntToStr(GreenPrec));
    199       Add('GreenShift: ' + IntToStr(GreenShift));
    200       Add('BluePrec: ' + IntToStr(BluePrec));
    201       Add('BlueShift: ' + IntToStr(BlueShift));
    202       Add('AlphaPrec: ' + IntToStr(AlphaPrec));
    203       Add('AlphaShift: ' + IntToStr(AlphaShift));
    204     end;
    205     ShowMessage(List.Text);
    206   finally
    207     List.Free;
    208   end;
     191begin
     192  ShowMessage(Image1.Picture.Bitmap.RawImage.Description.AsString);
     193end;
     194
     195procedure TMainForm.FormClose(Sender: TObject; var CloseAction: TCloseAction);
     196begin
     197  PersistentForm.Save(Self);
    209198end;
    210199
     
    229218procedure TMainForm.FormShow(Sender: TObject);
    230219begin
     220  PersistentForm.Load(Self);
    231221end;
    232222
Note: See TracChangeset for help on using the changeset viewer.