程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> Delphi >> 在Delphi中控制掃描儀(3)

在Delphi中控制掃描儀(3)

編輯:Delphi

附源代碼。

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.

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved