Brush style lazarus / 31-LCL ---------------------------------------------------------------------- spassigl · 2021-02-06 14:31 Hi I am filling a polygon with the following code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i with Canvas dobegin   Brush.Style := bsSolid;   Brush.Color := YtoColor(Y);   Pen.Color := Brush.Color;   Polygon(points);end;  So far so good. Now, for some polygons I want to use a diagonal pattern brush. So in the above code I set Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Brush.Style := bsFDiagonal But what's the right way to set the brush color - i.e. the space between the pattern? Brush.Color sets the pattern color not the background color. Thanks ---------------------------------------------------------------------- wp · 2021-02-06 14:37 IIRC you must use the Pen.Color to define the pattern color. ---------------------------------------------------------------------- spassigl · 2021-02-06 14:45 Quote from: wp on February 06, 2021, 03:37:12 pmIIRC you must use the Pen.Color to define the pattern color. No, the pattern color is set to Brush.Color. How can I set the actual Brush color that fills the space between the pattern lines? In Windows. you'd use SetBkColor(Canvas.Handle, clWhatever) but is there a portable solution? ---------------------------------------------------------------------- wp · 2021-02-06 15:17 Found this in my samples: do it in two steps - first draw the background with bsSolid, then the pattern with the corresponding brush style. Maybe there's a better way... Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.PaintBox1Paint(Sender: TObject);begin  Paintbox1.Canvas.Brush.Color := clRed;  Paintbox1.Canvas.Brush.Style := bsSolid;  Paintbox1.Canvas.FillRect(0, 0, Paintbox1.Width, Paintbox1.Height);   Paintbox1.Canvas.Brush.Color := clYellow;  Paintbox1.canvas.Brush.Style := bsHorizontal;  Paintbox1.Canvas.Rectangle(0, 0, Paintbox1.Width, Paintbox1.Height);end; ---------------------------------------------------------------------- spassigl · 2021-02-06 15:19 Oh well - why didn't I think of it?  Thanks - that will do in the meanwhile. Anyone has other inputs?