What are the TTextFormat (s) values ​​(used in TextRect) and their meanings?

I want to apply some text formats in a procedure TextRect

, but I haven't found any documentation. The Delphi help, in the TextRect

link, said TextFormat variabile can only have 3 values: tfAutoText, tfText, tfPlainText

. But here on StackOverflow I found some examples TextRect

with other text format values, eg tfEndEllipsis

. I searched for this using Delphi, and found another set with many text format values. When I tried them, the first set with these 3 values ​​doesn't work at all, but the second set does. I am embarrassed. Which set is good? The second seems to be because it works. But then what is the first set for?

And what is the meaning of the following values ​​(from the second set)?

  • tfCalcRect
  • tfEditControl
  • tfExpandTabs
  • tfExternalLeading
  • tfModifyString
  • tfNoClip
  • tfNoPrefix
  • tfRtlReading
  • tfWordBreak

Others are obvious ...

+3


source to share


1 answer


The documentation is wrong. Three types listed here are listed types ( tfAutoText

, tfText

, tfPlainText

) do not exist.

You need to read the source of the block Vcl.Graphics

to understand it. The source looks like this:



type
  TTextFormats = (tfBottom, tfCalcRect, tfCenter, tfEditControl, tfEndEllipsis,
    tfPathEllipsis, tfExpandTabs, tfExternalLeading, tfLeft, tfModifyString,
    tfNoClip, tfNoPrefix, tfRight, tfRtlReading, tfSingleLine, tfTop,
    tfVerticalCenter, tfWordBreak, tfHidePrefix, tfNoFullWidthCharBreak,
    tfPrefixOnly, tfTabStop, tfWordEllipsis, tfComposited);
  TTextFormat = set of TTextFormats;

      

And these values ​​map directly to flags used by the Win32 API function DrawTextEx

. You can find out what they mean by reading the documentation for this function.

+4


source







All Articles