【发布时间】:2018-04-06 07:55:59
【问题描述】:
我正在使用打印预览对话框,因此我想创建一个新行,以便在打印时使作业易于理解。我有一个挑战,因为我从文本框中得到它。一切似乎都被卡住了,因此我想知道我该怎么做。
代码是这样的
编辑
现在我的代码看起来像这样:
Image newImage = Image.FromFile("logo.png");
int width = 80;
int height = 50;
int ix = 100;
int iy = 100;
e.Graphics.DrawImage(newImage, ix, iy, width, height);
var fnt = new Font("Times new Roman", 14, FontStyle.Bold);
int x = 100, y = 100;
int dy = 20;
var header = new Font("Calibri", 21, FontStyle.Bold);
int hx = 100, hy = 100;
int hdy = 20;
e.Graphics.DrawString("Visitor GatePass™", header, Brushes.Black, new PointF(hx, hy)); hy += hdy;
e.Graphics.DrawString("Unique Number : " + uniqueNum.Text, fnt, Brushes.Black, new PointF(x, y)); y += dy;
e.Graphics.DrawString("Full Name : " + fullname.Text, fnt, Brushes.Black, new PointF(x, y)); y += dy;
e.Graphics.DrawString("Method of Identification : " + id_method.Text, fnt, Brushes.Black, new PointF(x, y)); y += dy;
e.Graphics.DrawString("Ward Name : " + ward_name.Text, fnt, Brushes.Black, new PointF(x, y)); y += dy;
e.Graphics.DrawString("Ward Class : " + ward_class.Text, fnt, Brushes.Black, new PointF(x, y)); y += dy;
e.Graphics.DrawString("Ward House : " + ward_house.Text, fnt, Brushes.Black, new PointF(x, y)); y += dy;
e.Graphics.DrawString("House Master : " + house_master.Text, fnt, Brushes.Black, new PointF(x, y)); y += dy;
e.Graphics.DrawString("Accompanying People : " + no_accPeople.Text, fnt, Brushes.Black, new PointF(x, y)); y += dy;
虽然有些部分是 Jammed ,例如徽标和其他一些格式。
【问题讨论】:
-
它“卡住了”,因为您从 X: 100 Y: 100 开始每个字符串。您需要更改这些。
-
哦好吧..让我试试@john
标签: c#