Is there a way to measure the amount of line that will fit into the print area without using a graphic?

Is there a way to measure the amount of line that will fit into the print area without using a graphic?

This is the only way to find this:

Graphics instance = this.CreateGraphics();
instance.MeasureString(text, f, printArea1, StringFormat.GenericDefault, 
     out end, out lines);

I use .net 2.0 and C #, but I am not against VB code.

+3
source share
3 answers

Yes, in .NET 2.0 there is

Size size = TextRenderer.MeasureString(this.Text, this.Font);

+5
source

The amount of space that the line will directly accept depends on the graphic object that you want to display in the line.

Are you printing a line on the screen, printer, memory surface, or bitmap? What DPI surface are you trying to measure text on? Which unit? What cosmic transformations need to be applied?

System.Drawing.Graphics, , .

, Graphics? - , , .

+2

, .

BASIC, ( ), , . , .

, , .

+1
source

Source: https://habr.com/ru/post/1702706/


All Articles