source: trunk/Packages/Common/Demo/ScaleDPI/UFormMain.pas

Last change on this file was 4, checked in by chronos, 9 years ago
  • Modified: Show drive size and I/O speed with proper units.
File size: 1.2 KB
Line 
1unit UFormMain;
2
3{$mode objfpc}{$H+}
4
5interface
6
7uses
8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
9 UScaleDPI;
10
11type
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
28var
29 Form1: TForm1;
30
31implementation
32
33uses
34 UFormTest;
35
36{$R *.lfm}
37
38{ TForm1 }
39
40procedure TForm1.FormShow(Sender: TObject);
41begin
42 Form2.Show;
43 ScaleDPI1.StoreDimensions(Form2, Dimensions);
44end;
45
46procedure TForm1.TrackBar1Change(Sender: TObject);
47begin
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;
54end;
55
56procedure TForm1.FormCreate(Sender: TObject);
57begin
58 Dimensions := TControlDimension.Create;
59end;
60
61procedure TForm1.FormDestroy(Sender: TObject);
62begin
63 Dimensions.Free;
64end;
65
66end.
67
Note: See TracBrowser for help on using the repository browser.