我能够打印 TextBox
的内容。我现在要做的是增加打印的份数。我正在尝试使用此 document.PrinterSettings.Copies = numQuantity.Value;
执行此操作。
numQuantity
是一个NumbericUpDown 控件
但是我得到了这个错误;
Cannot implicitly convert type 'decimal' to 'short'. An explicit conversion exists (are you missing a cast?)
我的代码:
private void document_PrintPage(object sender, PrintPageEventArgs e)
{
e.Graphics.DrawString(txtName.Text, new Font("Arial", 20, FontStyle.Regular), Brushes.Black, 20, 20);
}
private void btnPrint_Click(object sender, EventArgs e)
{
dialog.Document = document;
document.PrinterSettings.Copies = numQuantity.Value;
if (dialog.ShowDialog() == DialogResult.OK)
{
document.Print();
}
}
谢谢
最佳答案
尝试
document.PrinterSettings.Copies = Convert.ToInt16(numQuantity.Value);
关于c# - 打印时增加 TextBox 数据的副本数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35182388/