Replace SetTextAlign lazarus / 7-LCL ---------------------------------------------------------------------- lfrodrigues · 2007-09-05 01:09 I'm translating a Delphi app with uses SetTextAlign and then TextOut. I found  TCanvas.TextStyle.Alignment on Canvas and tried to use (win32) but they didn't produce the same result. Are they compatible? Best regards, Luis ---------------------------------------------------------------------- Phil · 2007-09-05 02:15 Quote from: "lfrodrigues"I'm translating a Delphi app with uses SetTextAlign and then TextOut. I found  TCanvas.TextStyle.Alignment on Canvas and tried to use (win32) but they didn't produce the same result. Are they compatible? SetTextAlign is a Win API function. You can simulate it by using GetTextMetrics to get information about the device context, then adjusting the X and Y coordinates appropriately (based on the flags passed to SetTextAlign) before passing the coords to TextOut. Thanks. -Phil ---------------------------------------------------------------------- lfrodrigues · 2007-09-05 11:55 Thanks for the reply. Could you please provide me with an example. If I have SetTExtAlign(canvas.handle, TA_LEFT) what should be the corresponding code? By the way, what is the use for TCanvas.TextStyle.Alignment ? ---------------------------------------------------------------------- antonio · 2007-09-05 12:20 See Delphi's help for it. ---------------------------------------------------------------------- Zaher · 2007-09-06 00:41 TCanvas.TextStyle is the default TextStyle for TextRect not for TextOut But maybe some one can hack TextOut to change MoveTo(X + TextWidth(Text), Y); to MoveTo(X - TextWidth(Text), Y); depending on Alignment, but before that my ask why we need it?, is your work is right to left, why not using TextRect. ---------------------------------------------------------------------- lfrodrigues · 2007-09-06 01:52 I was porting some Delphi code. I haven't used Lazarus for sometime so forgot about TextRect. Thanks.