ImageEn, unit iemview

TImageEnMView.InsertingPoint

TImageEnMView.InsertingPoint


Declaration

function InsertingPoint(x, y: Integer): Integer;


Description

Returns the index of the image before or after the x, y position. It is useful when an image needs to be inserted at a particular cursor position.

Note: Result will be ImageCount, if x, y position is not over an image


Example

// this drag/drop event copy all selected images of ImageEnMView1 to ImageEnMView2, starting at X, Y mouse position
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);
    inc(im);
    ImageEnMView1.ReleaseBitmap( idx );
  end;
end;