Printing Questions

09-29-2006, 11:54 AM

I'm currently trying to make printing easier for me and looking at the margins when printing a document using System.Drawing.Printing.PrintPageEventArgs

I noticed these are the following values:

Marginbounds.left = 100
Marginbounds.right = 750 = 100
Marginbounds.bottom = 1000
Marginbounds.height = 900
Marginbounds.width = 650

What measurement are these? The left margin is roughly an Inch, so my math can be lousy at times.

The other question I have is what is the best way to calculate the height of a font I am using to print? I have font sizes of 8 up to 14 and I use I've set a variable for LineHeight to be that of 16. Which I think is close to a font-size of 8. Or am I wrong?

I'm trying to write functions for writing headers and footers as well as being able to easily calculate where on the page I am so that I can check whether or not I should be going on to the next page or if I need to start the footer.

Another question is about declaration of variables when printing. My function that handles the printing is where I put all my font declariations and it looks like a mess. What can I do do clean it up and organize it a bit better? Currently it looks like this:

Dim sngLinesPerpage As Single = 0
Dim sngVerticalPosition As Single = 0
Dim intLineCount As Integer = 0
Dim g As Graphics = e.Graphics
Dim BoldFont As Font
Dim HeaderFont As Font
Dim smallFont As Font
Dim mediumFont As Font
Dim smallBoldFont As Font
Dim objPrintFont As Font
Dim signatureFont As Font
HeaderFont = New Font("Arial", 14, FontStyle.Bold)
BoldFont = New Font("Arial", 8, FontStyle.Bold)
mediumFont = New Font("Arial", 10, FontStyle.Bold)
smallFont = New Font("Arial", 8)
smallBoldFont = New Font("Arial", 9, FontStyle.Bold)
objPrintFont = New Font("Arial", 8, FontStyle.Bold)
signatureFont = New Font("KathleenieFont", 24, FontStyle.Bold)

To me that seems cluttered.

Thanks for any advice/suggestions etc.

09-30-2006, 11:07 AM
The printer margins (and other dimensions) are measured in 100th of an inch.

As for where to put the font descriptions it depends on how generic you want the printing module to be. In the print / preview datagrid ( example I have them as class level properties (HeaderFont, FooterFont etc.) so they can be set whereas in the much more generic (but more complicated) structured print document utility ( library I have implemented all the fonts and related code as "text styles" so you can easily modify the document style as a whole...

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum