ImageEn, unit imageenview |
|
TImageEnView.OnLayerMoveSize
Declaration
property OnLayerMoveSize: TIELayerMoveSizeEvent;
Description
Occurs whenever a layer is moved or resized. This event only fires on user actions (not programmatic changes). It will occur numerous times as the user moves the mouse.
Allows the layer size and position to be controlled and adjusted.
// Force all layers to be created at 200 x 200
procedure TfrmMain.ImageEnView1MoveSizeLayer(Sender: TObject; layer: integer; event: TIELayerEvent; var PosX, PosY, Width, Height: Double);
begin
if event = ielCreating then
begin
Width := 200;
Height := 200;
end;
end;
// Force all layers to be centered on the image horizon
procedure TfMain.ImageEnView1MoveSizeLayer(Sender: TObject; layer: integer; event: TIELayerEvent; var PosX, PosY, Width, Height: Double);
begin
PosY := ( ImageEnView1.Layers[0].Height - Height ) / 2;
end;
// Don't allow layer to be sized beyond boundaries of layer 1
procedure TMainForm.ImageEnView1LayerMoveSize(Sender: TObject; layer: Integer;
event: TIELayerEvent; var PosX, PosY, Width, Height: Double);
var
r: TRect;
lyr1: TIELayer;
begin
if layer > 1 then
begin
lyr1 := ImageEnView1.Layers[1];
if PosX < lyr1.PosX then
PosX := lyr1.PosX;
if PosY < lyr1.PosY then
PosY := lyr1.PosY;
if PosX + Width > lyr1.PosX + lyr1.Width then
Width := lyr1.PosX + lyr1.Width - PosX;
if PosY + Height > lyr1.PosY + lyr1.Height then
Height := lyr1.PosY + lyr1.Height - PosY;
end;
end;
See Also
◼OnNewLayer◼OnLayerNotifyEx◼AspectRatioLocked◼LayersResizeAspectRatio