e.Graphics.DrawString("Grand Total: £ " +grdtotal , new Font("Century Gothic", 12, FontStyle.Bold), Brushes.Crimson, new Point(60, pos + 50));
e.Graphics.DrawString("***The Android Dungeon*** \n", new Font("Century Gothic", 12, FontStyle.Bold), Brushes.Crimson, new Point(40, pos + 85));
e.Graphics.DrawString("Thank you - " + CusName.Text + "\n" , new Font("Century Gothic", 8, FontStyle.Bold), Brushes.Blue, new Point(40, pos));
e.Graphics.DrawString("\n" + Addresstb.Text + "\n", new Font("Century Gothic", 8, FontStyle.Bold), Brushes.Blue, new Point(80, pos ));
e.Graphics.DrawString("\n" + Postcodetb.Text + "\n", new Font("Century Gothic", 8, FontStyle.Bold), Brushes.Blue, new Point(100, pos ));
e.Graphics.DrawString("\n" + towntb.Text + "\n", new Font("Century Gothic", 8, FontStyle.Bold), Brushes.Blue, new Point(120, pos ));
当我打印收据时,所有的收据都打印在彼此的顶部,而这意味着是不同的行。我使用了\n
打印在不同的行上,但它们都打印在彼此的顶部,不应该是这样的,我把\n,它仍然没有打印在一个新的行?
1条答案
按热度按时间pgccezyw1#
让我们改进您的示例-注意备注
为了简单起见,我在这里假设行高为35,如果只是行高的话,我可以用
MeasureString
加上一个“M”来得到行高,这很有趣。像这样
进一步改进:
MeasureString
来确保字符串不会变得太大(太长)。对于这种情况,你可以想到不同的解决方案,如省略号或换行......由你决定。