Delphi - Draw text multiline in the centre of a rect

Viewed 17040

In Delphi i wish to draw text inside a TRect. I am hoping for the following functionality:

  1. Draw the text centred vertically within the TRect
  2. Draw the text centred horizontally within the TRect
  3. If there is space for more than 1 line of text (using TRect's height), draw the text multiline
  4. If the text does not fit in the TRect (either on a single or mult line) then append ellipsis to the text.

I can see the Windows.DrawText() function almost covers this functionality, however when writing text, multiline and vertically centred are mutually exclusive.

I was wondering if this functionality is built into windows (2000+)? If not is there a way to do this without writing my own function?

2 Answers
Related