-
Notifications
You must be signed in to change notification settings - Fork 0
/
ShowModalImage.pas
96 lines (83 loc) · 2.42 KB
/
ShowModalImage.pas
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
unit ShowModalImage;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls;
type
TFormShowModalImage = class(TForm)
Image1: TImage;
procedure FormShow(Sender: TObject);
procedure ShowImageFromGuestView;
procedure ShowImageFromMainView;
procedure FormKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormShowModalImage: TFormShowModalImage;
implementation
{$R *.dfm}
uses DM, Guest, Main;
procedure TFormShowModalImage.FormKeyPress(Sender: TObject; var Key: Char);
begin
if (Key = #27) then
Close;
end;
procedure TFormShowModalImage.FormShow(Sender: TObject);
begin
if GuestForm.Showing then
ShowImageFromGuestView;
if MainForm.Showing then
ShowImageFromMainView;
end;
procedure TFormShowModalImage.ShowImageFromGuestView;
begin
begin
try
begin
FormShowModalImage.Image1.Picture.LoadFromFile(GetCurrentDir+'/Images/'+DMl.ADOStoredProcGuestView.FieldByName('Image').Text);
Image1.Stretch := False;
Image1.Width := Image1.Picture.Width;
Image1.Height := Image1.Picture.Height;
FormShowModalImage.Width := Image1.Width;
FormShowModalImage.Height := Image1.Height;
end;
except
begin
FormShowModalImage.Image1.Picture.LoadFromFile(GetCurrentDir+ '\Images\no-image-large.jpg');
Image1.Stretch := False;
Image1.Width := Image1.Picture.Width;
Image1.Height := Image1.Picture.Height;
FormShowModalImage.Width := Image1.Width;
FormShowModalImage.Height := Image1.Height;
end;
end;
end;
end;
procedure TFormShowModalImage.ShowImageFromMainView;
begin
begin
try
begin
FormShowModalImage.Image1.Picture.LoadFromFile(GetCurrentDir+'/Images/'+DMl.ADOStoredProcMainView.FieldByName('Image').Text);
Image1.Stretch := False;
Image1.Width := Image1.Picture.Width;
Image1.Height := Image1.Picture.Height;
FormShowModalImage.Width := Image1.Width;
FormShowModalImage.Height := Image1.Height;
end;
except
begin
FormShowModalImage.Image1.Picture.LoadFromFile(GetCurrentDir+ '\Images\no-image-large.jpg');
Image1.Stretch := False;
Image1.Width := Image1.Picture.Width;
Image1.Height := Image1.Picture.Height;
FormShowModalImage.Width := Image1.Width;
FormShowModalImage.Height := Image1.Height;
end;
end;
end;
end;
end.