Einzelnen Beitrag anzeigen

Steffen0917

Registriert seit: 20. Jun 2005
64 Beiträge
 
Delphi 10 Seattle Enterprise
 
#3

AW: Problem mit DelphiTwain by Kluug.net

  Alt 17. Jul 2016, 11:25
Hallo Heiko,

ich bin leider kein Profi, vielleicht habe ich mich auch nur falsch ausgedrückt,
deshalb hier der Code mit meinen Änderungen:

Delphi-Quellcode:
unit SimpleExampleForm;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, StdCtrls, DelphiTwain, [B]DelphiTwain_VCL [/B];

type
  TForm1 = class(TForm)
    Title: TPanel;
    ImageHolder: TImage;
    GoAcquire: TButton;
    //Twain: TDelphiTwain; [B]--> verschoben in public[/B]
    procedure GoAcquireClick(Sender: TObject);
    procedure TwainTwainAcquire(Sender: TObject; const Index: Integer;
      Image: TBitmap; var Cancel: Boolean);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
    [B]Twain: TDelphiTwain;[/B]
  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;
Steffen

Geändert von MrSpock (18. Jul 2016 um 16:50 Uhr)
  Mit Zitat antworten Zitat