I do not get the same results that you do.
DFM
object Form1: TForm1
Left = 0
Top = 0
Caption = 'TImage Copy and Paste'
ClientHeight = 337
ClientWidth = 635
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
OnDestroy = FormDestroy
PixelsPerInch = 96
TextHeight = 13
object Splitter1: TSplitter
Left = 325
Top = 32
Width = 5
Height = 305
ExplicitTop = 41
ExplicitHeight = 213
end
object Panel1: TPanel
Left = 0
Top = 0
Width = 635
Height = 32
Align = alTop
BevelOuter = bvNone
TabOrder = 0
object Open1: TButton
Left = 9
Top = 3
Width = 75
Height = 25
Caption = 'Open'
TabOrder = 0
OnClick = Open1Click
end
object Copy: TButton
Left = 90
Top = 3
Width = 75
Height = 25
Caption = 'Copy'
TabOrder = 1
OnClick = CopyClick
end
object Paste1: TButton
Left = 171
Top = 3
Width = 75
Height = 25
Caption = 'Paste'
TabOrder = 2
OnClick = Paste1Click
end
end
object ScrollBox1: TScrollBox
Left = 0
Top = 32
Width = 325
Height = 305
Align = alLeft
BevelInner = bvNone
BevelOuter = bvNone
TabOrder = 1
ExplicitTop = 41
ExplicitHeight = 213
object Image1: TImage
Left = 0
Top = 0
Width = 321
Height = 301
Align = alClient
Picture.Data = {07544269746D617000000000}
ExplicitLeft = 13
ExplicitTop = 16
ExplicitWidth = 105
ExplicitHeight = 105
end
end
object ScrollBox2: TScrollBox
Left = 330
Top = 32
Width = 305
Height = 305
Align = alClient
BevelInner = bvNone
BevelOuter = bvNone
TabOrder = 2
ExplicitLeft = 331
ExplicitTop = 41
ExplicitWidth = 304
ExplicitHeight = 213
object Image2: TImage
Left = 0
Top = 0
Width = 301
Height = 301
Align = alClient
Picture.Data = {07544269746D617000000000}
ExplicitLeft = 13
ExplicitTop = 16
ExplicitWidth = 105
ExplicitHeight = 105
end
end
object ImageEnProc1: TImageEnProc
PreviewsParams = [prppShowResetButton, prppHardReset]
PreviewFont.Charset = DEFAULT_CHARSET
PreviewFont.Color = clWindowText
PreviewFont.Height = -11
PreviewFont.Name = 'Tahoma'
PreviewFont.Style = []
AttachedTImage = Image1
Left = 63
Top = 55
end
object ImageEnIO1: TImageEnIO
PreviewFont.Charset = DEFAULT_CHARSET
PreviewFont.Color = clWindowText
PreviewFont.Height = -11
PreviewFont.Name = 'Tahoma'
PreviewFont.Style = []
AttachedTImage = Image1
Left = 26
Top = 53
end
object OpenPictureDialog1: TOpenPictureDialog
Left = 28
Top = 83
end
object ImageEnProc2: TImageEnProc
PreviewsParams = [prppShowResetButton, prppHardReset]
PreviewFont.Charset = DEFAULT_CHARSET
PreviewFont.Color = clWindowText
PreviewFont.Height = -11
PreviewFont.Name = 'Tahoma'
PreviewFont.Style = []
AttachedTImage = Image2
Left = 230
Top = 50
end
end
PAS
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.ExtDlgs, imageenio, imageenproc, hyiedefs,
hyieutils {, jpeg, gifimg, pngimage};
type
TForm1 = class(TForm)
Panel1: TPanel;
Open1: TButton;
Copy: TButton;
Paste1: TButton;
ScrollBox1: TScrollBox;
Image1: TImage;
ImageEnProc1: TImageEnProc;
ImageEnIO1: TImageEnIO;
OpenPictureDialog1: TOpenPictureDialog;
ScrollBox2: TScrollBox;
Image2: TImage;
ImageEnProc2: TImageEnProc;
Splitter1: TSplitter;
procedure FormCreate(Sender: TObject);
procedure Open1Click(Sender: TObject);
procedure CopyClick(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Paste1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.CopyClick(Sender: TObject);
begin
{ Copy image to the clipboard }
ImageEnProc1.CopyToClipboard(False);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
{ Register ImageEn File Formats with TPicture }
IERegisterFormats;
OpenPictureDialog1.filter := GraphicFilter(TGraphic);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
{ Unregister Picture formats }
IEUnRegisterFormats;
end;
procedure TForm1.Open1Click(Sender: TObject);
begin
if OpenPictureDialog1.Execute then
begin
{ Load an image with ImageEnIO1 attached to Image 1 }
ImageEnIO1.LoadFromFile(OpenPictureDialog1.FileName);
ScrollBox1.HorzScrollBar.Range := Image1.Picture.Width;
ScrollBox1.VertScrollBar.Range := Image1.Picture.Height;
end;
end;
procedure TForm1.Paste1Click(Sender: TObject);
begin
{ Paste the clipboard to Image2 }
ImageEnProc2.PasteFromClipboard;
ScrollBox2.HorzScrollBar.Range := Image2.Picture.Width;
ScrollBox2.VertScrollBar.Range := Image2.Picture.Height;
end;
end.
William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Custom ImageEn Development