ImageEn, unit imageenview

TImageEnView.AsyncLoading

TImageEnView.AsyncLoading


Declaration

property AsyncLoading: Boolean;


Description

Set to load images in a background thread to prevent tying up up the user interface.

Note:
 When AsyncLoading is enabled, calls to LoadFromFile will be asynchronous, so you will need to use OnImageLoaded to update your application user interface
 If you attempt to access IEBitmap by code, or user interaction, ImageEn will force loading (become synchronous)
 This method uses AsyncMode


Demo

Demo  Demos\Multi\MView_AttachedViewer\MViewPreview.dpr
Demo  Demos\Multi\MViewPreview\MViewPreview.dpr


Example

// Load images in background thread
procedure TMainForm.btnLoadClick(Sender: TObject);
begin
  ImageEnView1.AsyncLoading := True;
  ImageEnView1.IO.LoadFromFile( IEFolderMView.SelectedFilename );
end;

// Update the UI
procedure TMainForm.ImageEnView1ImageLoaded(Sender: TObject);
begin
  lblSize.Caption := Format( '%d x %d px', [ ImageEnView1.IEBitmap.Width, ImageEnView1.IEBitmap.Height ]);
end;