ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Demo ImageEnMView_DD
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

John

USA
94 Posts

Posted - Mar 11 2016 :  18:02:58  Show Profile  Reply
Hello

If I place an ImageEnView1 component on the demo main form, I can capture the file name of a selected image from the ImageEnMView1 component via the ImageEnMView1.OnSelectImage event. I can then load the selected image into the ImageEnView1 component with the following two lines of code

ImageEnView1.Clear
ImageEnView1.IO.LoadFromFile(ImageEnMView1.ImageFileName[idx]);

However, If I drag the image from the ImageEnMView1 to ImageEnMView2 and then try to select the image from the ImageEnMView2 component and load the selected image into the ImageEnView1 component, the file name is not captured and the image is not loaded. see below

ImageEnView1.Clear;
ImageEnView1.IO.LoadFromFile(ImageEnMView2.ImageFileName


Any help would be greatly appreciated.

John

w2m

USA
1990 Posts

Posted - Mar 11 2016 :  18:27:04  Show Profile  Reply
Use the ImageEnMView1.MIO.Params[idx].FileName property instead of the ImageFileName[idx]) then in the ImageEnMView2DragDrop event copy theImageEnMView1.MIO.Params[idx].filename to
ImageEnMView2.MIO.Params[im].FileName;

procedure TForm1.ImageEnMView2DragDrop(Sender, Source: TObject; X,
  Y: Integer);
var
  i: integer;
  idx, im: integer;
  tmpbmp: TBitmap;
begin
  im := ImageEnMView2.InsertingPoint(X, Y);
  for i := 0 to ImageEnMView1.MultiSelectedImagesCount - 1 do
  begin
    idx := ImageEnMView1.MultiSelectedImages[i];
    tmpbmp := ImageEnMView1.GetBitmap(idx);

    ImageEnMView2.InsertImage(im);
    ImageEnMView2.SetImage(im, tmpbmp);
    ImageEnMView2.MIO.Params[im].FileName := ImageEnMView1.MIO.Params[idx].FileName;
    inc(im);

    ImageEnMView1.ReleaseBitmap(idx);
  end;
end;

After the drop the ImageEnMView1.MIO.Params[idx].FileName and the ImageEnMView2.MIO.Params[idx].FileName will be the same for each.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: