110,561
社区成员
发帖
与我相关
我的任务
分享
System.Drawing.Printing.PrintDocument p = new System.Drawing.Printing.PrintDocument();
p.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(p_PrintPage);
p.Print();
void p_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
foreach (Control item in groupBox1.Controls)
{
if (item is Label)
{
Label l = item as Label;
e.Graphics.DrawString(l.Text, l.Font, new SolidBrush(l.ForeColor), l.Location);
}
}
}
打印groupBox1上所有的label