使用TDELPHITWAIN时,在控制的界面按取消按钮后,不能重新打开控制界面

rogueskilldan 2010-05-07 11:39:10
原码:
unit SimpleExampleForm;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, DelphiTwain;

type
TForm1 = class(TForm)
Title: TPanel;
ImageHolder: TImage;
GoAcquire: TButton;
Twain: TDelphiTwain;
procedure GoAcquireClick(Sender: TObject);
procedure TwainTwainAcquire(Sender: TObject; const Index: Integer;
Image: TBitmap; var Cancel: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

{Acquire into image}
procedure TForm1.GoAcquireClick(Sender: TObject);
var
SelectedSource: Integer;
begin
{It is always recommended to load library dynamically, never forcing}
{final user to have twain installed}
if Twain.LoadLibrary then
begin

{Load source manager}
Twain.SourceManagerLoaded := TRUE;
{Allow user to select source}
SelectedSource := Twain.SelectSource;
if SelectedSource <> -1 then
begin
{Load source, select transference method and enable (display interface)}
Twain.Source[SelectedSource].Loaded := TRUE;
Twain.Source[SelectedSource].TransferMode := ttmMemory;
Twain.Source[SelectedSource].Enabled := TRUE;
end {if SelectedSource <> -1}

end
else
showmessage('Twain is not installed.');
end;

{Image acquired}
procedure TForm1.TwainTwainAcquire(Sender: TObject; const Index: Integer;
Image: TBitmap; var Cancel: Boolean);
begin
ImageHolder.Picture.Assign(Image);
Cancel := TRUE; {Only want one image}
end;

end.

出现步骤:
1.点击扫描按钮
2.选择扫描的驱动,点击确定,然后出现控制扫描的窗口
3.在控制扫描的窗口按“取消”按钮
4.再次点击扫描按钮,出现选择驱动窗口,选择驱动后,控制扫描的窗口没有出现
...全文
129 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
hcqi2004 2010-06-09
  • 打赏
  • 举报
回复
有机会交流一下qq519351936
hcqi2004 2010-06-09
  • 打赏
  • 举报
回复
这个程序在我电脑上运行正常,
我按照你写的步骤操作了多辩,也没出现你说的问题

5,927

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧