Consider the following code:
procedure TForm1.PaintBox1Paint(Sender: TObject);
var
vRect : TRect;
vFormat : TTextFormat;
vStr : string;
begin
vStr := 'This is some text';
vRect := rect(10,10,50,130);
vFormat := [tfCenter,tfVerticalCenter,tfWordBreak];
PaintBox1.Canvas.Rectangle(vRect);
PaintBox1.Canvas.TextRect(vRect,vStr,vFormat);
end;
I would expect something like this
+--------+
| |
| |
|This is |
| some |
| text |
| |
| |
+--------+
but I get this
+--------+
|This is |
| some |
| text |
| |
| |
| |
| |
+--------+
The same is true for the tfBottom format. The horizontal text formats (tfLeft, tfRight, tfCenter) work as expected, but the vertical formats doesn't. Can anyone explain this?