tags:

views:

30

answers:

1
  1. 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.

  2. 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?

+1  A: 
  1. hundredths of an inch
  2. I think you need GraphicsUnit.Point in your font constructor if you want to ensure units in points.
ThatSteveGuy
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?
okay but for the Pen? how do I force its width to be in X Pixel or X mm?
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