I've been "having fun" trying to get printing to work as well. I
highly recommend this site:
http://msdn.microsoft.com/library/de...ntwinforms.asp
If you haven't already figured out your problem, give the following a
try. I belive your problem has to do with units, but not really sure.
(The following is kindof a mess, sorry. It's a lot of cut & paste
from a project I was working on).
private void printAccounts_PrintPage(object sender,
System.Drawing.Printing.PrintPageEventArgs e)
{
Graphics g = e.Graphics;
g.PageUnit = GraphicsUnit.Inch;
// convert to inches
float leftMargin = e.MarginBounds.Left / 100F;
float rightMargin = e.MarginBounds.Right / 100F;
float topMargin = e.MarginBounds.Top / 100F;
float bottomMargin = e.MarginBounds.Bottom / 100F;
float width = e.MarginBounds.Width / 100F;
float height = e.MarginBounds.Height / 100F;
float currentPosition = topMargin;
e.HasMorePages = false;
string headerText = "Hello Bobby C. Jones";
RectangleF headerTextLayout = new RectangleF (
leftMargin, topMargin, width, height );
float headerHeight;
StringFormat headerStringFormat = new
StringFormat(StringFormatFlags.LineLimit);
headerStringFormat.Alignment = StringAlignment.Center;
headerStringFormat.Trimming = StringTrimming.EllipsisWord;
Font printFont = new Font("Arial", 10);
headerHeight = g.MeasureString (headerText,
this.HeaderFont, headerTextLayout.Size,
headerStringFormat).Height;
headerTextLayout.Height = headerHeight;
// do the actual drawing
g.FillRectangle(new SolidBrush(Color.AliceBlue),
headerTextLayout);
g.DrawString(headerText, printFont, Brushes.Black,
headerTextLayout, headerStringFormat);
}
"Bobby C. Jones" <bo****@acadx.com> wrote in message
news:Od*************@TK2MSFTNGP09.phx.gbl...
Ok, so I had a couple of minutes after lunch to play around a bit
with the System.Drawing.Printing namespace. I just wanted to print out a
single line of text. I had to work very hard to resist the urge to print out
"Hello World!" <g>