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