DrawText "cursor" position lazarus / 21-General ---------------------------------------------------------------------- big_M · 2022-07-05 11:39 So, I'm currently using DrawText to write text on a canvas with a fixed width, but I need to paint something in between, or behind the text. Is there any way to get the coordinates of the end of the text? I thought I could maybe use canvas.penpos, but that stays at (0,0) after I used DrawText. Maybe canvas.textout could work, but then I would have to manage the line breaks myself I think, so if I could get the coordinates using DrawText would be great. Any idea? ---------------------------------------------------------------------- Handoko · 2022-07-05 11:52 Maybe TextExtend can help, see this demo: https://forum.lazarus.freepascal.org/index.php/topic,46775.msg333936.h tml#msg333936 ---------------------------------------------------------------------- big_M · 2022-07-05 12:17 Interesting, that might help. Thanks! ---------------------------------------------------------------------- AlexTP · 2022-07-05 15:52 You can use TCanvas.TextWidth(S).