The application which I am upgrading with TRichView had the ability to center text both horizontally and vertically.
I achieved the vertical centering by loading the text into an invisible TMemo and using TMemo's Lines.Count property to count the lines. I then calculated the number of lines possible in the resizeable window and inserted 1/2 this number of blank lines in front of the text before displaying it in the actual TMemo.
I tried using the obsolete TRV.Lines property, but it doesn't seem to actually return the number of lines - more like the number of items?
Do you have any suggestion on how to achieve vertical centering for a TRichViewEdit (read only)?
Thanks!
How To Center Vertically
-
- Posts: 148
- Joined: Wed Dec 07, 2005 2:02 pm
- Contact:
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Posts: 148
- Joined: Wed Dec 07, 2005 2:02 pm
- Contact:
That was easy!
Perhaps cross reference the .VAlign property (of TRichView, TRichViewEdit) with the .Style.ParaStyles[0].Alignment property to make it easier to see the relationship between the global vertical centering and the by-paragraph horizontal centering.
It's clear to me NOW why it's that way, but after finding the horizontal centering I didn't think to look at the global level for the vertical control.
Thanks!
Perhaps cross reference the .VAlign property (of TRichView, TRichViewEdit) with the .Style.ParaStyles[0].Alignment property to make it easier to see the relationship between the global vertical centering and the by-paragraph horizontal centering.
It's clear to me NOW why it's that way, but after finding the horizontal centering I didn't think to look at the global level for the vertical control.
Thanks!