Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

THotSpotImage
How to programmatically add & delete hotspots

It is equally possible to programmatically add & delete hotspots.
This code snippet adds an ellips shaped hotspot to the THotSpotImage:

with HotSpotImage.HotSpots.Add do
begin
   X := 50;
   Y := 50;
   Width := 75;
   Height := 75;
   ShapeType := stEllipse;
   Clipped := true;
   SelectedColor := clLime;
   Hint := 'This is a programmatically added ellipse';
   Name := 'Circle close to Iceland';
   ID := 1;
end;
The result after clicking with the following OnHotSpotClick event handler:

procedure TForm2.HotSpotImageHotSpotClick(Sender: TObject; HotSpot: THotSpot);
begin
  ShowMessage('Hotspot clicked: '+ IntToStr(HotSpot.ID) + ':'+ HotSpot.Name);
end
;

This results in: