Triangles with TShape lazarus / 31-LCL ---------------------------------------------------------------------- ercolano · 2013-11-30 22:14 If you select stTriangle in TShape control you get an isoceles triangle pointing upwards. Is ther any way to change the triangle type (pointing down/left/right); the mirror and flip options seem to be greyed out. What about right angles triangles? ---------------------------------------------------------------------- ercolano · 2013-11-30 22:27 Just to reply to own message...I've now found what I believe to be the 'source', in the file Shape.inc in Lazarus->lcl->Include. Clearly only this type of triangle is drawn, BUT it shoudn't be too difficult to add the other sorts. But If I modify this file, how to I 'recompile'. Also, I suppose modifying  built in control will break compatibility. What would be the best way to proceed? ---------------------------------------------------------------------- wp · 2013-11-30 22:46 Without good reason I'd NEVER modify the Lazarus sources - you'll have to update your modifications each time you update Lazarus. Post a feature request to bugtracker for more triangle shapes. For a quick solution use a TPaintbox where you can draw any shape in the OnPaint event. Code: [Select]procedure TForm1.PaintBox1Paint(Sender: TObject); var   P: array[0..3] of TPoint; begin   with Paintbox1.Canvas do begin     Brush.Color := Paintbox1.Color;     Pen.Color := clBlack;     P[0] := Point(0, 0);     P[1] := Point(Paintbox1.Width-1, 0);     P[2] := Point(Paintbox1.Width div 2, Paintbox1.Height-1);     P[3] := P[0];     Polygon(P);   end; end; ---------------------------------------------------------------------- ercolano · 2013-12-01 00:21 Quote from: wp on November 30, 2013, 11:46:40 pm For a quick solution use a TPaintbox where you can draw any shape in the OnPaint event. Thanks for the quick reply and suggeston. Is there a function where I can test to see if a mouse click falls within a polygon? In other environments I have used things like: Code: [Select]procedure mouseClick(int x int y); begin      if(PixelWithinPolygon(p[],x,y).....  // p[] is where I first saved the list of polygon points. ---------------------------------------------------------------------- taazz · 2013-12-01 00:46 Something like this? Code: [Select]function PtInPoly    (const Points: Array of TPoint; X,Y: Integer):    Boolean; var Count, K, J : Integer; begin   Result := False;   Count := Length(Points) ;   J := Count-1;   for K := 0 to Count-1 do begin    if ((Points[K].Y <=Y) and (Y < Points[J].Y)) or       ((Points[J].Y <=Y) and (Y < Points[K].Y)) then    begin     if (x < (Points[j].X - Points[K].X) *        (y - Points[K].Y) /        (Points[j].Y - Points[K].Y) + Points[K].X) then         Result := not Result;     end;     J := K;   end; end;            Or a more generic solution like Code: [Select]uses lclintf; ..... var   tmp : hrgn; begin   tmp := CreatePolygonRgn(@Points[0], 100, WINDING);   PtInRegion(tmp,Point.X,Point.Y); end; Both should work  well I think. ---------------------------------------------------------------------- ercolano · 2013-12-01 11:48 Quote from: taazz on December 01, 2013, 01:46:09 am Or a more generic solution like ....[PtInRegion] That's the type of thing I was looking for....perfect