Last change
on this file was 28, checked in by chronos, 8 years ago |
- Added: Remember forms dimensions.
- Added: Remember recent opened files.
|
File size:
1.2 KB
|
Line | |
---|
1 | unit UFormMain;
|
---|
2 |
|
---|
3 | {$mode objfpc}{$H+}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
|
---|
9 | UScaleDPI;
|
---|
10 |
|
---|
11 | type
|
---|
12 |
|
---|
13 | { TForm1 }
|
---|
14 |
|
---|
15 | TForm1 = class(TForm)
|
---|
16 | ScaleDPI1: TScaleDPI;
|
---|
17 | TrackBar1: TTrackBar;
|
---|
18 | procedure FormCreate(Sender: TObject);
|
---|
19 | procedure FormDestroy(Sender: TObject);
|
---|
20 | procedure FormShow(Sender: TObject);
|
---|
21 | procedure TrackBar1Change(Sender: TObject);
|
---|
22 | private
|
---|
23 | { private declarations }
|
---|
24 | public
|
---|
25 | Dimensions: TControlDimension;
|
---|
26 | end;
|
---|
27 |
|
---|
28 | var
|
---|
29 | Form1: TForm1;
|
---|
30 |
|
---|
31 | implementation
|
---|
32 |
|
---|
33 | uses
|
---|
34 | UFormTest;
|
---|
35 |
|
---|
36 | {$R *.lfm}
|
---|
37 |
|
---|
38 | { TForm1 }
|
---|
39 |
|
---|
40 | procedure TForm1.FormShow(Sender: TObject);
|
---|
41 | begin
|
---|
42 | Form2.Show;
|
---|
43 | ScaleDPI1.StoreDimensions(Form2, Dimensions);
|
---|
44 | end;
|
---|
45 |
|
---|
46 | procedure TForm1.TrackBar1Change(Sender: TObject);
|
---|
47 | begin
|
---|
48 | with ScaleDPI1 do begin
|
---|
49 | DPI := Point(TrackBar1.Position, TrackBar1.Position);
|
---|
50 | ScaleDimensions(Form2, Dimensions);
|
---|
51 | Form2.ImageList1.Assign(Form2.ImageList2);
|
---|
52 | ScaleImageList(Form2.ImageList1, DesignDPI);
|
---|
53 | end;
|
---|
54 | end;
|
---|
55 |
|
---|
56 | procedure TForm1.FormCreate(Sender: TObject);
|
---|
57 | begin
|
---|
58 | Dimensions := TControlDimension.Create;
|
---|
59 | end;
|
---|
60 |
|
---|
61 | procedure TForm1.FormDestroy(Sender: TObject);
|
---|
62 | begin
|
---|
63 | Dimensions.Free;
|
---|
64 | end;
|
---|
65 |
|
---|
66 | end.
|
---|
67 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.