-
Notifications
You must be signed in to change notification settings - Fork 1
/
old_code.txt
50 lines (37 loc) · 1.46 KB
/
old_code.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
var
SelectedFileName:String;
Picture:TPicture;
OriginalWidth:Integer;
OriginalHeight:Integer;
FormHeight:Integer;
FormWidth:Integer;
Bitmap:TBitmap;
begin
OpenDialog1.Title:='Open an Image..';
if OpenDialog1.Execute then
begin
SelectedFileName:=OpenDialog1.FileName;
Picture:=TPicture.Create;
Picture.LoadFromFile(SelectedFileName);
// get the original size of the selected file
OriginalWidth:=Picture.Bitmap.Width;
OriginalHeight:=Picture.Bitmap.Height;
// get the form height and width
FormHeight:=MainForm.ClientHeight;
FormWidth:=MainForm.ClientWidth;
// ShowMessage('Width:'+IntToStr(OriginalWidth)+' Height:'+IntToStr(OriginalHeight)+LineEnding+' Form Width:'+IntToStr(FormWidth)+'Form Height:'+IntToStr(FormHeight));
FFileName := SelectedFileName;
try
//T := GetTimeMicroseconds;
FImage.LoadMultiFromFile(SelectedFileName);
//MeasureTime(Format('File %s opened in:', [ExtractFileName(FileName)]), T);
except
MessageDlg(GetExceptObject.Message, mtError, [mbOK], 0);
FImage.CreateFromParams(32, 32, ifA8R8G8B8, 1);
end;
FImage.LoadMultiFromFile(SelectedFileName);
Image.Picture.Graphic:=Picture.Graphic;
Picture.Free;
LabelFileName.Caption:=SelectedFileName;
AutoFit(Sender);
end;