Determining Width of Text for TfrxMemoView

I'm creating TfrxMemoView components in the header band of a report and am having difficulty figuring out how to determine the necessary width of the component based on the text value that will be assigned. I've tried setting the value of a TfrxLabel and measuring the TextWidth of the Canvas, but that doesn't seem to match up. For example 


TestLabel.TextSettings.Font.Family := 'Arial';

TestLabel.TextSettings.Font.Size := 10;

TestLabel.TextSettings.Font.Style := [TFontStyle.fsBold];

Width := TestLabel.Canvas.TextWidth('Replacement');


results in a value of about 68 pixels (.70 inches). But when I add the text to the TfrxMemoView component directly, it requires about 1 inch to display without truncating the text. 


How can I determine the necessary width needed for the TfrxMemoView component for a text value?

Comments

  • gpigpi Volnovakha, Ukraine

    Try to use TfrxMemoView.CalcWidth function

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.