Add the following code to the Horizontal ImageEnMView:
procedure TMainForm.ImageEnMViewHorzontal1AfterEvent(Sender: TObject; Event: TIEAfterEvent);
{ This draws the insert point vertical red line }
var
imgX, imgY :integer;
begin
if (Event = ieaePaint) and ImageEnMViewHorzontal1.Dragging and (fDragInsertPos > -1) then
begin
if fDragInsertPos >= ImageEnMViewHorzontal1.ImageCount then
begin
// Position at end of last thumbnail
imgX := ImageEnMViewHorzontal1.ImageX[ImageEnMViewHorzontal1.ImageCount - 1] - ImageEnMViewHorzontal1.ViewX;
imgY := ImageEnMViewHorzontal1.ImageY[ImageEnMViewHorzontal1.ImageCount - 1] - ImageEnMViewHorzontal1.ViewY + ImageEnMViewHorzontal1.ThumbHeight - 2;
end
else
begin
// Position before current thumbnail
imgX := ImageEnMViewHorzontal1.ImageX[fDragInsertPos] - ImageEnMViewHorzontal1.ViewX;
imgY := ImageEnMViewHorzontal1.ImageY[fDragInsertPos] - ImageEnMViewHorzontal1.ViewY + 1;
end;
with ImageEnMViewHorzontal1.GetCanvas do
begin
Pen.Color := clRed;
Pen.Width := 3;
Pen.Style := psSolid;
MoveTo(ImgX, 0);
LineTo(ImgX, ImgY + ImageEnMViewHorzontal1.ThumbHeight);
end;
end;
end;
procedure TMainForm.ImageEnMViewHorzontal1DragDrop(Sender, Source: TObject; X, Y: Integer);
{ This moves the selected image to the inserting point }
var
im:integer;
begin
ImageEnMViewHorzontal1.MultiSelectSortList; // selection order is not important
im := ImageEnMViewHorzontal1.InsertingPoint(X, Y);
ImageEnMViewHorzontal1.MoveSelectedImagesTo(im);
end;
procedure TMainForm.ImageEnMViewHorzontal1DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState;
var Accept: Boolean);
begin
fDragInsertPos := -1;
if Source = ImageEnMViewHorzontal1 then
begin
Accept := True;
fDragInsertPos := ImageEnMViewHorzontal1.InsertingPoint(X, Y);
end;
ImageEnMViewHorzontal1.Paint;
end;
procedure TMainForm.ImageEnMViewHorzontal1EndDrag(Sender, Target: TObject; X, Y: Integer);
begin
ImageEnMViewHorzontal1.IEEndDrag;
ImageEnMViewHorzontal1.MouseInteract := [mmiSelect];
ImageEnMViewHorzontal1.Paint;
end;
procedure TMainForm.ImageEnMViewHorzontal1ImageSelect(Sender: TObject; idx: Integer);
begin
// Copy image
ImageEnMViewHorzontal1.CopyToIEBitmap( idx, ImageEnVect1.IEBitmap );
// Copy annotations
ImageEnVect1.RemoveAllObjects;
ImageEnMViewHorzontal1.MIO.Params[idx].ImagingAnnot.CopyToTImageEnVect(ImageEnVect1);
ImageEnVect1.Update;
end;
procedure TMainForm.ImageEnMViewHorzontal1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
if (ssLeft in Shift) then
begin
ImageEnMViewHorzontal1.MouseInteract := [];
ImageEnMViewHorzontal1.IEBeginDrag(true, -1);
end;
end;
Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development