ImageEn, unit imageenview

TImageEnView.OnDrawLayerBox

TImageEnView.OnDrawLayerBox


Declaration

property OnDrawLayerBox: TIEDrawLayerBoxEvent;


Description

Occurs when a layer box must be painted (LayersDrawBox must be enabled). If you handle this event the default behavior is disabled.
ABitmap is the destination bitmap and layer is the layer index that we are drawing.
Use Layers[].ClientAreaBox rectangle to get actual rectangle coordinates.

See the LayerEditing\Layers demo for more details.

Note: You can also use SetLayersBoxStyle to customize the layer box style


Examples

procedure Tfmain.ImageEnView1DrawLayerBox(Sender: TObject; ACanvas: TCanvas; LayerIndex: Integer);
begin
  // a green line
  with ACanvas do
  begin
    Pen.Style := psSolid;
    Pen.Width := 2;
    Pen.mode := pmCopy;
    Pen.Color := clGreen;
    Brush.Style := bsClear;
    with ImageEnView1.Layers[LayerIndex].ClientAreaBox do
      Rectangle(Left-1, Top-1, Right+1, Bottom+1);
  end;
end;

// Use an empty OnDrawLayerBox to prevent a selection box from being drawn around the current layer
procedure Tfmain.ImageEnView1DrawLayerBox(Sender: TObject; ACanvas: TCanvas; LayerIndex: Integer);
begin
  //
end;


Compatibility Information

Prior to v8.0.0, OnDrawLayerBox used a TBitmap rather than a TCanvas. You may need to remove the existing event and add the event handler again.