我用 C# 开发了一个应用程序,我想在打印机中打印我的表单中的标签,而不是打印整个表单。我的四个标签是lblName, lblAge, lblAdd, lblEmail
. 我只想打印这些标签而不是表格。有人可以帮我吗?谢谢!
无论如何,这是我单击按钮时要打印的代码。
private void btnPrint_Click(object sender, EventArgs e)
{
PaperSize pp = new PaperSize("MyReport", 718, 359);
printForm1.PrinterSettings.DefaultPageSettings.PaperSize = pp;
printForm1.PrinterSettings.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
//printForm1.PrintAction = System.Drawing.Printing.PrintAction.PrintToPreview;
printForm1.Print(this, PrintForm.PrintOption.CompatibleModeClientAreaOnly);
}