Lazarus
Programming => General => Topic started by: big_M on July 05, 2022, 01:39:36 pm
-
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?
-
Maybe TextExtend can help, see this demo:
https://forum.lazarus.freepascal.org/index.php/topic,46775.msg333936.html#msg333936
-
Interesting, that might help. Thanks!
-
You can use TCanvas.TextWidth(S).