?? imager.pas
字號:
unit imager;
interface
uses Windows,Forms, Graphics, jpeg, ExtCtrls, Classes, Controls;
type
Tvjpeg = class(TForm)
Image1: TImage;
procedure OpenFile(const Filename: string;rescale:single=1);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
implementation
uses main;
{$R *.DFM}
procedure Tvjpeg.OpenFile(const Filename: string;rescale:single=1);
var outputx,outputy:integer;
scale:single;
wind:hwnd;
begin
Form1.Caption:='Jpeg Image '+filename;
try
Image1.Picture.LoadFromFile(Filename);
except
on EInvalidGraphic do
begin
{Image1.Picture.Graphic := nil;}
exit;
end;
else exit;
end;
Scale := Image1.Picture.Height / (Rescale*Image1.Picture.Width);
outputx:=screen.width;
outputy:=Trunc(outputx*Scale);
if outputy>screen.height then
begin
outputy:=screen.height;
outputx:=Trunc(outputy/Scale);
end;
image1.left:=(screen.width-outputx) div 2;
image1.width:=outputx;
image1.top:=(screen.height-outputy) div 2;
image1.height:=outputy;
show;
wind:=self.Handle;
setwindowpos(wind,HWND_TOPMOST,0,0,screen.width,screen.height,SWP_SHOWWINDOW);
end;
procedure Tvjpeg.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
hide;
Canclose:=true;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -