delphi - Firemonkey: How can I detect the X position of a character in a memo -
i'm trying develop method justify text in memo/label. need take x position of character. possible? if not, how can justify texts in firemonkey? know possible on desktop using vlc library, found nothing firemonkey.
i haven't found getting x coords of chars. can create array of widths of characters font , make method count absolute x , y of characters, this:
for y := 0 memo.lines.count - 1 x := 0 memo.lines[y].length - 1 begin absolutex := absolutex + charwidths[memo.lines[y][x]]; absolutey := absolutey + charheights[memo.lines[y][x]]; // careful, crossplatform using should use copy(), not string[n] end;
for text align can use this(for label have vertextalign)
memo.textalign := ttextalign.trailing; // right justify memo.textalign := ttextalign.center; // center justify memo.textalign := ttextalign.leading; // default left justify
Comments
Post a Comment