Douglas,
There are several ways to center the text, one of them is by getting the rectangle of the page boundaries.
string text1 = "Este texto será centralizado no TOPO";
using (Font font1 = new Font("Arial", 12, FontStyle.Bold, GraphicsUnit.Point))
{
//O string format serve para formatar strings
//quanto a seu alinhamento e o proprio alinhamento da linha
StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Center;
SolidBrush drawBrush = new SolidBrush(System.Drawing.Color.Black);
//Captura todo o retângulo dos limites da página
System.Drawing.RectangleF rect = e.PageBounds;
//Aumenta a coordenada de localização Y
rect.Y += 50;
//Desenhar texto centralizado
e.Graphics.DrawString(text1, font1, drawBrush, rect, sf);
}
How is it a Printdocument the property Pagebounds allows capturing the rectangle associated with the page limit. I increased the value of the coordinate Y to "look like" a Title.
gave right vlw
– Douglas