in the constructor of PaperSize, what unit are the numbers in?
var ps = new PaperSize( "Custom Size", XX , YY );
I'm using PrintDocument to do some print out and need to create a page size (w x h) of 9.79cm by 14.75cm.
I'm using
e.Graphics.PageUnit = GraphicsUnit.Millimeter;
I want to crate a font of 24 points,Font titleFont = new Font( STR_Arial, 24, FontStyle.Regular );
is this correct?
views:
30answers:
1
+1
A:
- hundredths of an inch
- I think you need GraphicsUnit.Point in your font constructor if you want to ensure units in points.
ThatSteveGuy
2010-08-16 01:50:52
Thanks that gave me the closest size,so Im using new System.Drawing.Printing.PaperSize( "Custom Size", 385, 587 );protected override void OnPrintPage( PrintPageEventArgs e ){ base.OnPrintPage( e ); var g = e.Graphics; g.PageUnit = GraphicsUnit.Millimeter; Pen p = new Pen( Color.Red, 1 ); Font titleFont = new Font( STR_Arial, 24, FontStyle.Regular );is the pen width 1pixel or 1mm or what?in my tests its becoming very fat.Can I on change g.GraphicsUnit back and forth between pixel (for lines) and millimeters (for positioning Text) and would that work?
2010-08-16 02:15:00
okay but for the Pen? how do I force its width to be in X Pixel or X mm?
2010-08-16 02:23:09
I believe setting the width to a negative number will force a one pixel line. For other line widths, I think you have to actually scale (tranform) the pen to get consistent results. I can't swear to that second part, but I think it's right.
ThatSteveGuy
2010-08-16 02:55:04