我有一些代码,我用它来打印C#的收据.
下面的代码打印正常,但我正在努力调整左右中心的文本,
Graphics graphics = e.Graphics;
Font font = new Font("Courier New", 10);
float fontHeight = font.GetHeight();
int startX = 0;
int startY = 0;
int Offset = 0;
graphics.DrawString("Welcome to MSST", new Font("Courier New", 14), new SolidBrush(Color.Black), startX, startY + Offset);
Offset = Offset + 20;
graphics.DrawString("Recept No :" + receptno + 1, new Font("Courier New", 14), new SolidBrush(Color.Black), startX, startY + Offset);
Offset = Offset + 20;
graphics.DrawString("Date :" + DateTime.Today, new Font("Courier New", 12), new SolidBrush(Color.Black), startX, …Run Code Online (Sandbox Code Playgroud)