stPolygon in TMSFMXHotSpotImage

Hi guys, how do I add a stPolygon to TMSFMXHotSpotImage with programming?

thanks

Hi, 


An example is



var
  h: TTMSFMXHotSpot;
begin
  h := TMSFMXHotSpotImage1.HotSpots.Add;
  h.ShapeType := stPolygon;
  h.PolyPoints := [PointF(100, 100), PointF(300, 300), PointF(300, 100)];

Thanks Pieter

Hi guys , I have been testing  the hotspotimage, I found the following errors,

1.- when I create a shape with programming, this line is ommited  hotspot.SelectedStroke.Color:=TAlphaColorRec.red; , the  color stroke is not showed on the shape

2.-If I create a shape with programming and then assign an image with the hotspotimage editor,
the clipped Hotspot properties do not work

I have a question, is it possible assign an image the shape from an TMSFMXBitmapContainer1?

you can download my example project the following link 

https://www.dropbox.com/s/hddl1qrfhcu623y/HotSpotImage.zip?dl=0
https://www.dropbox.com/s/xyzuk8ou2qrdok6/IMG_7362.MOV?dl=0

thanks

  1. We'll investigate exactly what happens with the rectangle type, as a workaround, you can define a rectangle in any polygon as well, which correctly shows the border



   hotspot := TMSFMXHotSpotImage1.HotSpots.Add;
   hotspot.ShapeType := stPolygon;
   hotspot.PolyPoints := [PointF(50, 50), PointF(100, 50), PointF(100, 200), PointF(50, 200)];
   hotspot.SelectedStroke.Color:=TAlphaColorRec.red;
   hotspot.Clickfill.Color:=TAlphaColorRec.Cadetblue;
   hotspot.ID:=10;
   hotspot.SelectedFill.Color:=System.UITypes.TAlphaColorrec.Cadetblue;
   hotspot.Selected:=true;
   hotspot.Clipped:=True;
   hotspot.Hint:='10';


2) This works as expected here, which code did you use exactly?

It is possible to assign an image, the hotspot shape has a BitmapContainer property and several BitmapName properties that should match the name specified in the BitmapContainer
Hi pieter , for point number 2 I used this code

procedure TForm676.FormCreate(Sender: TObject);
var
 hotspot: TTMSFMXHotSpot;
begin
TMSFMXHotSpotImage1.Bitmap.Assign(TMSFMXBitmapContainer1.Items[1].Bitmap);
  {$IFDEF TMSIOS}
  Button1.Visible := False;
  {$ENDIF}
   hotspot := TMSFMXHotSpotImage1.HotSpots.Add;
   hotspot.ShapeType := stRectangle;
   hotspot.X1 := 50;
   hotspot.Y1 := 50;
   hotspot.X2 := 100;
   hotspot.Y2 := 200;
   hotspot.SelectedStroke.Color:=TAlphaColorRec.red;
   hotspot.Clickfill.Color:=TAlphaColorRec.Cadetblue;
   hotspot.ID:=10;
   hotspot.SelectedFill.Color:=TAlphaColor($665F9EA0);
   hotspot.Selected:=true;
   hotspot.Clipped:=True;
   hotspot.Hint:='10';

please see the video

https://www.dropbox.com/s/xyzuk8ou2qrdok6/IMG_7362.MOV?dl=0

For the second issue, can you perhaps also use the code to add a rectangle through a polygon:


 hotspot.ShapeType := stPolygon;
   hotspot.PolyPoints := [PointF(50, 50), PointF(100, 50), PointF(100, 200), PointF(50, 200)];

Thanks Pieter