Recent

Author Topic: DrawText "cursor" position  (Read 275 times)

big_M

  • New Member
  • *
  • Posts: 44
DrawText "cursor" position
« 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?

Handoko

  • Hero Member
  • *****
  • Posts: 4679
  • My goal: build my own game engine using Lazarus
Re: DrawText "cursor" position
« Reply #1 on: July 05, 2022, 01:52:31 pm »

big_M

  • New Member
  • *
  • Posts: 44
Re: DrawText "cursor" position
« Reply #2 on: July 05, 2022, 02:17:47 pm »
Interesting, that might help. Thanks!

AlexTP

  • Hero Member
  • *****
  • Posts: 1843
    • UVviewsoft
Re: DrawText "cursor" position
« Reply #3 on: July 05, 2022, 05:52:58 pm »
You can use TCanvas.TextWidth(S).

 

TinyPortal © 2005-2018