TImageEnMView.IEBeginDrag
Declaration
procedure IEBeginDrag(Immediate: Boolean; Threshold: Integer = -1);
Description
ImageEn's implementation of BeginDrag. You must use this for Drag/Drop operations in TImageEnMView.
Note: Add ietxShowInsertPointWhileDragging to
IOOptionsEx to display the position of inserted objects
| Demos\Multi\DragDrop_MultiView2\Multiview2.dpr |
| Demos\Multi\DragDrop_MultiView\TImageEnMView_DD.dpr |
| Demos\LayerEditing\DragDropLayers\Layers_DragDrop.dpr |
| Demos\Multi\DragDrop_FileList_2\TImageEnMView_FileList.dpr |
// Allow images from a TImageEnMView to be dropped onto a TImageEnView as layers
procedure TMainForm.ImageEnMView1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
if ssLeft in Shift then
begin
(Sender as TImageEnMView).MouseInteract := [];
(Sender as TImageEnMView).IEBeginDrag(False, -1);
end;
end;
procedure TMainForm.ImageEnMView1EndDrag(Sender, Target: TObject; X, Y: Integer);
begin
(Sender as TImageEnMView).IEEndDrag();
(Sender as TImageEnMView).MouseInteract := [mmiSelect];
end;
procedure TMainForm.ImageEnView1DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
begin
if (Source is TImageEnMView) then
Accept := True;
end;
procedure TMainForm.ImageEnView1DragDrop(Sender, Source: TObject; X, Y: Integer);
var
bmp: TIEBitmap;
idx: Integer;
begin
idx := TImageEnMView(Source).SelectedImage;
if idx >= 0 then
begin
bmp := ImageEnMView1.GetTIEBitmap( idx );
ImageEnView1.LayersAdd( bmp );
ImageEnView1.CurrentLayer.PosX := ImageEnView1.XScr2Bmp( X );
ImageEnView1.CurrentLayer.PosY := ImageEnView1.YScr2Bmp( Y );
TImageEnMView(Source).ReleaseBitmap(idx, False);
ImageEnView1.Update();
end;
end;
See Also
◼IEEndDrag
◼iemoOptimizeForDragging