我有一个用于创建标签的 WinForm。
它调用 a并使用's中的PrintPreviewDialog显示信息。PrintPageEventArgsPrintDocumentPrintPageEventHandler
void Document_Printed(object sender, PrintPageEventArgs e) {
  // Code goes here
}
如果标签是一个小地址标签,它是一个 8.5x11 的字母,而不是在 中看到单个标签PrintPreviewDialog,我想查看适合该标签的标签数量PageSettings.PaperSize。
示例:假设四 (4) 个项目适合所选介质(Avery 打印机标签或任何东西)。
- 如果我的最终用户指定要打印 1 到 4 个副本,我希望我的打印预览对话框显示所有副本。 
- 如果我的最终用户指定的项目超过四 (4) 个,则打印预览对话框应该显示多个页面(我以前从未处理过多个页面)。 
我可以调整我的数据大小以适合我的标签大小,但我不知道如何让我PrintPageEventHandler在PrintPreviewDialog.
有人可以告诉我这是怎么做到的吗?如何在每张工作表上显示和打印多个标签(文档?)?
编辑:这是我的代码,它基于 2 个 RectangleF 对象:pageRect 和 LabelRect:
void Document_Printed(object sender, PrintPageEventArgs e) {
  if (printPreview == null) return;
  int labelSupport = 1;
  RectangleF pageRect = new RectangleF(0, 0, printPreview.Document.DefaultPageSettings.PaperSize.Width, printPreview.Document.DefaultPageSettings.PaperSize.Height);
  float fW = (pageRect.Width < LabelRect.Width) ? (pageRect.Width / LabelRect.Width) : (LabelRect.Width / pageRect.Width);
  float fH = (pageRect.Height < LabelRect.Height) ? (pageRect.Height / LabelRect.Height) : (LabelRect.Height / pageRect.Height);
  // START Portion I need HELP with!
  if (1 < LabelsPerPage) {
    if (Landscape) {
    } else {
    }
  } else {
    if (Landscape) {
    } else {
    }
  }
  // END (I think) Portion I need HELP with!
  SizeF ratio = new SizeF(fW, fH);
  Graphics G = e.Graphics;
  foreach (Label item in labelList) {
    Console.WriteLine(item.Name);
    using (SolidBrush b = new SolidBrush(Color.Black)) {
      using (Pen p = new Pen(b)) {
        float x = ratio.Width * (float)item.Location.X;
        float y = ratio.Height * (float)item.Location.Y;
        float w = ratio.Width * (float)item.Size.Width;
        float h = ratio.Height * (float)item.Size.Height;
        RectangleF r = new RectangleF(x, y, w, h);
        G.DrawString(item.Text, item.Font, b, r);
      }
    }
  }
}
编辑 2:我需要一种在 1 页上打印 2 个或更多文档的方法。到目前为止,还没有解决这个关键点。这就是我需要的答案。