---- 附源代碼。
unit scanu;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls,
Forms, Dialogs, Menus, ScanLib_TLB, ExtCtrls, AxCtrls,
OleCtrls, ImgeditLib_TLB;
type
Tscanf = class(Tform)
MainMenu1: TMainMenu;
F1: TMenuItem;
N15: TMenuItem;
N1: TMenuItem;
N2: TMenuItem;
N16: TMenuItem;
N11: TMenuItem;
N5: TMenuItem;
C1: TMenuItem;
N4: TMenuItem;
E1: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N3: TMenuItem;
N10: TMenuItem;
N9: TMenuItem;
N1801: TMenuItem;
N901: TMenuItem;
N902: TMenuItem;
H1: TMenuItem;
N12: TMenuItem;
N13: TMenuItem;
ImgEdit1: TImgEdit;
Bevel1: Tbevel;
ImgScan1: TImgScan;
Bevel2: Tbevel;
procedure N4Click(Sender: Tobject);
procedure N1Click(Sender: Tobject);
procedure N2Click(Sender: Tobject);
procedure C1Click(Sender: Tobject);
procedure N8Click(Sender: Tobject);
procedure N1801Click(Sender: Tobject);
procedure N901Click(Sender: Tobject);
procedure N902Click(Sender: Tobject);
procedure N6Click(Sender: Tobject);
procedure N7Click(Sender: Tobject);
procedure ImgEdit1SelectionRectDrawn(Sender: Tobject; Left,Top,
Width, Height: Integer);
procedure N11Click(Sender: Tobject);
private
{ Private declarations }
public
selleft,seltop,selwidth,selheight:integer;
{ Public declarations }
end;
var
scanf: Tscanf;
implementation
{$R *.DFM}
procedure Tscanf.N4Click(Sender: Tobject);
begin
imgedit1.ClearDisplay;
close;
end;
procedure Tscanf.N1Click(Sender: Tobject);
begin
ImgScan1.ShowSelectScanner;
end;
procedure Tscanf.N2Click(Sender: Tobject);
begin
imgedit1.zoom:=100;
if not imgscan1.ScannerAvailable then
imgscan1.OpenScanner;
imgscan1.StartScan;
imgscan1.CloseScanner;
end;
procedure Tscanf.C1Click(Sender: Tobject);
begin
if imgedit1.ImageDisplayed then
begin
imgedit1.ClearDisplay;
imgedit1.zoom:=100;
end;
end;
procedure Tscanf.N8Click(Sender: Tobject);
begin
if (imgedit1.IsClipboardDataAvailable and imgedit1.ImageDisplayed )
then
imgedit1.ClipboardPaste(selleft,seltop);
end;
procedure Tscanf.N1801Click(Sender: Tobject);
begin
if imgedit1.ImageDisplayed then
imgedit1.Flip;
end;
procedure Tscanf.N901Click(Sender: Tobject);
begin
if imgedit1.ImageDisplayed then
imgedit1.RotateRight
end;
procedure Tscanf.N902Click(Sender: Tobject);
begin
if imgedit1.ImageDisplayed then
imgedit1.RotateLeft;
end;
procedure Tscanf.N6Click(Sender: Tobject);
begin
imgedit1.DrawSelectionRect(selleft,seltop,selwidth,selheight);
imgedit1.ClipboardCut(selleft,seltop,selwidth,selheight);
end;
procedure Tscanf.N7Click(Sender: Tobject);
begin
imgedit1.DrawSelectionRect(selleft,seltop,selwidth,selheight);
imgedit1.ClipboardCopy(selleft,seltop,selwidth,selheight);
end;
procedure Tscanf.ImgEdit1SelectionRectDrawn(Sender: Tobject; Left,
Top, Width, Height: Integer);
begin
if ((width=0) and (height=0))then
begin
n3.Enabled:=false;
n6.Enabled:=false;
n7.Enabled:=false;
selleft:=left;
seltop:=top;
selwidth:=width;
selheight:=height;
end
else begin
n6.Enabled:=true;
n7.Enabled:=true;
selleft:=left;
seltop:=top;
selwidth:=width;
selheight:=height;
end;
end;
procedure Tscanf.N11Click(Sender: Tobject);
begin
if not imgedit1.IsClipboardDataAvailable then
if imgedit1.imagedisplayed then
imgedit1.ClipboardCopy(0,0,imgedit1.Width,imgedit1.Height);
end;
end.