Calculating Content Width
Posted: Fri Jul 08, 2011 6:17 pm
At my work, we have built our on custom label built using TRichView. We are using the TRVReportHelper to paint to the label's canvas. It has become necessary to identify the width and height of the content being painted so that we can calculate the size to make the label.
Currently, we successfully calculate the height of the content by painting to a temporary bitmap and returning RVReportHelper.GetLastPageHeight.
Now, I am working on calculating the width. Assuming the following guidelines are always true, what is the best way to do this:
- The content will not word wrap. It will consume only one line.
- The content will not contain any non-text items.
Currently, we successfully calculate the height of the content by painting to a temporary bitmap and returning RVReportHelper.GetLastPageHeight.
Now, I am working on calculating the width. Assuming the following guidelines are always true, what is the best way to do this:
- The content will not word wrap. It will consume only one line.
- The content will not contain any non-text items.