private void button2_Click(object sender, EventArgs e)
{
printDocument1.PrintController = new StandardPrintController();//不提示直接打印
printDocument1.Print();
}
//打印窗体label标签内容
private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
{
Graphics g = e.Graphics;
g.DrawString(label1.Text, label1.Font, new SolidBrush(label1.ForeColor), new PointF(label1.Left, label1.Top));
g.DrawString(label2.Text, label2.Font, new SolidBrush(label2.ForeColor), new PointF(label2.Left, label2.Top));
g.DrawString(label3.Text, label3.Font, new SolidBrush(label3.ForeColor), new PointF(label3.Left, label3.Top));
g.DrawString(label4.Text, label4.Font, new SolidBrush(label4.ForeColor), new PointF(label4.Left, label4.Top));
g.DrawString(label5.Text, label5.Font, new SolidBrush(label5.ForeColor), new PointF(label5.Left, label5.Top));
}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。