How to display rich text on Canvas? lazarus / 39-Graphics ---------------------------------------------------------------------- loaded · 2022-02-19 09:04 Hi All, Printing text in rich text format (*.rtf) directly to the canvas Or is it possible to reflect the rich memo object to the canvas? I would be very happy if you share your experience and suggestions. Regards. ---------------------------------------------------------------------- Thaddy · 2022-02-19 10:39 The rich memo does exactly that: it writes the rtf to the/a canvas. ---------------------------------------------------------------------- dbannon · 2022-02-19 11:11 KMemo in KControls is a bit more complete especially if you are interested in cross platform. Being all pascal, its very portable. I use it in tomboy-ng, its an interesting "API" but once you get used to it, does the goods. But it does slow down if content gets much beyond 50K characters. Davo ---------------------------------------------------------------------- loaded · 2022-02-19 11:27 Thaddy and dbannon thank you very much for your answers. I would like to clarify the matter a little more. My goal is to show Rich text view on canvas belonging to Image object. So I won't have an event to recreate or change it. When I inspect the TRichMemo class, there is nothing about the canvas !!! (I probably don't know how to look) How is he doing this? Looks like we'll have to do some research. This is the first time I've heard of Kmemo. I'll look into it at a convenient time. Respects. ---------------------------------------------------------------------- wp · 2022-02-19 13:34 I looked at TRichMemo. It does not access any canvas at all; it seems to delegate the entire painting process to the widgetset. There are a TRichView and a TRtfView component on CCR which are very similar. They both have a Paint routine in which the RTF content is painted to a temporary bitmap. You probably can extract the painting code and adapt it as needed. Both components seem to be abandoned. The TKMemo, already mentioned by dbannon, is still maintained by its original author (github), and it even has a PaintToCanvas method to which the canvas of a bitmap can be passed. However, this is only a protected method, i.e. not accessible by your application. You must write your own descendant of TKMemo and declare that method as public (very easy job, in my opinion). Or contact the author, tell him your request and ask him to implement it. ---------------------------------------------------------------------- Thaddy · 2022-02-19 16:34 Quote from: wp on February 19, 2022, 02:34:21 pmI looked at TRichMemo. It does not access any canvas at all; I meant TRichView, but the above is not possible: you would not get anything painted.... There needs to be a canvas somewhere.... :'( ---------------------------------------------------------------------- loaded · 2022-02-19 18:53 Thank you very much for the reply Master wp Quote from: wp on February 19, 2022, 02:34:21 pmYou must write your own descendant of TKMemo and declare that method as public (very easy job, in my opinion). I guess the only thing I can do until I reach this level is to contact the author at a suitable time...