One of the part of my project is RichTextBox
with string length form 10 to 50 chars, and font's size 175-225 in single line. I use special printer: 100 mm height, and 3000 mm (3m) width ribbon. Very long width is a real problem.
I've got problem with Printing.PaperSize
width element (I have to use it). It's (MSDN) "The width of the paper, in hundredths of an inch".
I tried to get this from:
RichTextBox1.PreferredSize.Width
g.MeasureString(RichTextBox1.Text, RichTextBox1.Font).Width
g.MeasureCharacterRanges(Text, Font, Rect, Format)
All of them gives me "pixels" but I have no idea how can I use it with Printing.PaperSize
- all of them are too short, and dependent on used font family.
Tricky part of this is that I need very precise length of my PaperSize
, because I have to print several items before and after the string.
Is any way to estimate printed width (in cm/inches) when I have only pixel size of element?
If anyone can give me any answer in C#, or C++ it doesn't matter - I will be grateful.