小编Rya*_*ray的帖子

收据打印的中心文本

我有一些代码,我用它来打印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)

c# printing alignment winforms

2
推荐指数
1
解决办法
4537
查看次数

标签 统计

alignment ×1

c# ×1

printing ×1

winforms ×1