property OnDraw: TNotifyEvent; //read and write
This event is called every time the Paths property is updated.
Before drawing Paths onto a layer's Image, they'll need to offset relative to the layer's position.
And apart from drawing, this event is also the perfect time to update hit-testing (see UpdateHitTestMask).
procedure TForm1.DrawPolygonLayer(Sender: TObject);
var
tmpPaths: TPathsD;
begin
with Sender as TVectorLayer32 do
begin
tmpPaths := OffsetPath(Paths, -Left, -Top);
DrawPolygon(Image, tmpPaths, frEvenOdd, $8000FFFF);
DrawLine(Image, tmpPaths, DpiAware(1.5), clNavy32, esPolygon);
UpdateHitTestMask(tmpPaths, frEvenOdd);
end;
end;
TLayer32.Image, UpdateHitTestMask
Copyright ©2010-2023 Angus Johnson - Image32 4.8 - Help file built on 16 Apr 2025