| 1 | unit Unit1;
|
|---|
| 2 |
|
|---|
| 3 | {$mode delphi}{$H+}
|
|---|
| 4 |
|
|---|
| 5 | interface
|
|---|
| 6 |
|
|---|
| 7 | uses
|
|---|
| 8 | Classes, SysUtils, XMLConf, FileUtil, Forms, Controls, Graphics, Dialogs,
|
|---|
| 9 | Buttons, StdCtrls, ExtCtrls, ComCtrls, Menus, XMLPropStorage, PersistentForm;
|
|---|
| 10 |
|
|---|
| 11 | type
|
|---|
| 12 |
|
|---|
| 13 | { TForm1 }
|
|---|
| 14 |
|
|---|
| 15 | TForm1 = class(TForm)
|
|---|
| 16 | ListView1: TListView;
|
|---|
| 17 | PersistentForm1: TPersistentForm;
|
|---|
| 18 | Timer1: TTimer;
|
|---|
| 19 | XMLConfig1: TXMLConfig;
|
|---|
| 20 | procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
|---|
| 21 | procedure FormResize(Sender: TObject);
|
|---|
| 22 | procedure FormShow(Sender: TObject);
|
|---|
| 23 | procedure Timer1Timer(Sender: TObject);
|
|---|
| 24 | private
|
|---|
| 25 | procedure AddValue(Name, Value: string);
|
|---|
| 26 | public
|
|---|
| 27 | { public declarations }
|
|---|
| 28 | procedure ShowDimensions;
|
|---|
| 29 | end;
|
|---|
| 30 |
|
|---|
| 31 | var
|
|---|
| 32 | Form1: TForm1;
|
|---|
| 33 |
|
|---|
| 34 | const
|
|---|
| 35 | WindowStateText: array[TWindowState] of string = ('wsNormal', 'wsMinimized',
|
|---|
| 36 | 'wsMaximized', 'wsFullScreen');
|
|---|
| 37 |
|
|---|
| 38 | implementation
|
|---|
| 39 |
|
|---|
| 40 | {$R *.lfm}
|
|---|
| 41 |
|
|---|
| 42 | { TForm1 }
|
|---|
| 43 |
|
|---|
| 44 | procedure TForm1.FormShow(Sender: TObject);
|
|---|
| 45 | begin
|
|---|
| 46 | PersistentForm1.Load(Self);
|
|---|
| 47 | end;
|
|---|
| 48 |
|
|---|
| 49 | procedure TForm1.Timer1Timer(Sender: TObject);
|
|---|
| 50 | begin
|
|---|
| 51 | ShowDimensions;
|
|---|
| 52 | end;
|
|---|
| 53 |
|
|---|
| 54 | procedure TForm1.AddValue(Name, Value: string);
|
|---|
| 55 | var
|
|---|
| 56 | NewItem: TListItem;
|
|---|
| 57 | begin
|
|---|
| 58 | NewItem := ListView1.Items.Add;
|
|---|
| 59 | NewItem.Caption := Name;
|
|---|
| 60 | NewItem.SubItems.Add(Value);
|
|---|
| 61 | end;
|
|---|
| 62 |
|
|---|
| 63 | procedure TForm1.ShowDimensions;
|
|---|
| 64 | begin
|
|---|
| 65 | with ListView1.Items do begin
|
|---|
| 66 | Clear;
|
|---|
| 67 | AddValue('Form.Left', IntToStr(Self.Left));
|
|---|
| 68 | AddValue('Form.Top', IntToStr(Self.Top));
|
|---|
| 69 | AddValue('Form.Width', IntToStr(Self.Width));
|
|---|
| 70 | AddValue('Form.Height', IntToStr(Self.Height));
|
|---|
| 71 | AddValue('Form.RestoredLeft', IntToStr(Self.RestoredLeft));
|
|---|
| 72 | AddValue('Form.RestoredTop', IntToStr(Self.RestoredTop));
|
|---|
| 73 | AddValue('Form.RestoredWidth', IntToStr(Self.RestoredWidth));
|
|---|
| 74 | AddValue('Form.RestoredHeight', IntToStr(Self.RestoredHeight));
|
|---|
| 75 | AddValue('Form.BoundsRect.Left', IntToStr(Self.BoundsRect.Left));
|
|---|
| 76 | AddValue('Form.BoundsRect.Top', IntToStr(Self.BoundsRect.Top));
|
|---|
| 77 | AddValue('Form.BoundsRect.Right', IntToStr(Self.BoundsRect.Right));
|
|---|
| 78 | AddValue('Form.BoundsRect.Bottom', IntToStr(Self.BoundsRect.Bottom));
|
|---|
| 79 | AddValue('Screen.DesktopLeft', IntToStr(Screen.DesktopLeft));
|
|---|
| 80 | AddValue('Screen.DesktopTop', IntToStr(Screen.DesktopTop));
|
|---|
| 81 | AddValue('Screen.DesktopWidth', IntToStr(Screen.DesktopWidth));
|
|---|
| 82 | AddValue('Screen.DesktopHeight', IntToStr(Screen.DesktopHeight));
|
|---|
| 83 | AddValue('WindowState', WindowStateText[Self.WindowState]);
|
|---|
| 84 | end;
|
|---|
| 85 | end;
|
|---|
| 86 |
|
|---|
| 87 | procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
|---|
| 88 | begin
|
|---|
| 89 | PersistentForm1.Save(Self);
|
|---|
| 90 | end;
|
|---|
| 91 |
|
|---|
| 92 | procedure TForm1.FormResize(Sender: TObject);
|
|---|
| 93 | begin
|
|---|
| 94 | ShowDimensions;
|
|---|
| 95 | end;
|
|---|
| 96 |
|
|---|
| 97 | end.
|
|---|
| 98 |
|
|---|