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_P rintPage(object sender,
System.Drawing. Printing.PrintP ageEventArgs e)
{
Graphics g = e.Graphics;
g.PageUnit = GraphicsUnit.In ch;
// 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 headerTextLayou t = new RectangleF (
leftMargin, topMargin, width, height );
float headerHeight;
StringFormat headerStringFor mat = new
StringFormat(St ringFormatFlags .LineLimit);
headerStringFor mat.Alignment = StringAlignment .Center;
headerStringFor mat.Trimming = StringTrimming. EllipsisWord;
Font printFont = new Font("Arial", 10);
headerHeight = g.MeasureString (headerText,
this.HeaderFont , headerTextLayou t.Size,
headerStringFor mat).Height;
headerTextLayou t.Height = headerHeight;
// do the actual drawing
g.FillRectangle (new SolidBrush(Colo r.AliceBlue),
headerTextLayou t);
g.DrawString(he aderText, printFont, Brushes.Black,
headerTextLayou t, headerStringFor mat);
}
"Bobby C. Jones" <bo****@acadx.c om> wrote in message
news:Od******** *****@TK2MSFTNG P09.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>