I want to use Canvas.TextRect to write something on the canvas with 90 degree angle and word wrap capability. I also want the text to be vertically aligned in the rectangle. How do I do that?
I want to use Canvas.TextRect to write something on the canvas with 90 degree
Share
Here is a sample code to create a vertical font:
Update: Try to render vertical text on a form:
Update 2: I think it’s better to use the DrawTextEx Function which supports text alignment and word wrapping.
My Delphi version doesn’t include it in the documentation but you can see the various flags in the above link.
Below is a sample code to see how to use it. I have disabled vertical font because it seems that word wrapping doesn’t work well with vertical fonts.
Note that when you want to align text in the rectangle you should use the
DT_SINGLELINEflag.For example this combination:
DT_CENTER or DT_VCENTER or DT_SINGLELINE, will center the text in the middle of the rectangle.