How to use TBrush pattern? lazarus / 39-Graphics ---------------------------------------------------------------------- wp · 2017-02-07 17:18 Can anybody give me a short example how the BrushStyle bsPattern (of TBrush) is used? I suppose it is needed to extend the built-in fill patterns (bsCross, bsHorizontal, etc). Why are the more usual BrushStyles (such as bsSolid, bsClear etc) redeclared in graphics, but bsPattern and bsImage not? They require unit FPCanvas. ---------------------------------------------------------------------- LuizAmérico · 2017-02-07 20:42 Try https://bitbucket.org/blikblum/pascal-demos/src/4fcb11397f1aa6b41e b9cd53379351c97de61b3a/lazarus/LCLTests/PatternBrush/?at=master ---------------------------------------------------------------------- wp · 2017-02-07 21:17 Thank you - this works fine, it is the "Windows" way, though. I would have expected that bsPattern for TBrush could be supported in way analogous to TPen's psPattern - you set Pen.Style := psPattern and call Pen.SetPattern(). Can I interpret your answer in a way that the LCL itself does not support the BrushStyle bsPattern, at least at the moment? In this case, I should write a feature request. The background of the question is that I wrote a TChartCombobox which can be used to edit series pointer styles, pen styles, pen widths, and brush styles, and could not find a reasonable solution for the BrushStyle bsPattern. ---------------------------------------------------------------------- LuizAmérico · 2017-02-08 09:03 Set TBrush.Bitmap to the bitmap you want to use as pattern and TBrush.Style = bsPattern ---------------------------------------------------------------------- wp · 2017-02-08 09:48 So easy? I can't believe it... But: What is the difference to bsImage then? Look at the attached demo. It contains four paintboxes, two paint standard brushes (bsCross and bsFDiagonal), one paints bsPattern, and one paints psImage, the latters ones with an alternating black/white bitmap. The paintboxes with bsPattern and psImage look the same. I would have expected that the pattern color of bsPattern could be controlled by changing the Brush.Color (as with the standard patterns). But nothing happens. Then I thought, maybe the bsPattern bitmap should be a 1-bit pixelformat (use FBitmap1 in Paintbox1Paint), but then the entire paintbox goes black. Another related question: Is there a way to control the background color of non-solid fills in an LCL-conformal way (without going the Windows way as in your demo)? ---------------------------------------------------------------------- LuizAmérico · 2017-02-08 13:53 QuoteBut: What is the difference to bsImage then? I dont know QuoteLook at the attached demo Sorry no time for now QuoteAnother related question: Is there a way to control the background color of non-solid fills in an LCL-conformal way (without going the Windows way as in your demo)? AFAIK bsPattern with no mono bitmap is always solid. I tried with a transparent bitmap (png) and it did not work. For mono bitmaps play with Brush.Color, Font.Color Luiz