问题描述
我的 flowlayout 面板中有一组用户控件,我想使用 printdocument 每页打印用户控件。有没有其他方法可以解决我的问题?
我在我的 printpage 方法中尝试了这段代码 -
for (int i = numberOfItemsPrintedSoFar; i < chequeContainer.Controls.Count; i++)
{
numberOfItemsPerPage++;
if (numberOfItemsPerPage <= 3)
{
numberOfItemsPrintedSoFar++;
if (numberOfItemsPrintedSoFar <= chequeContainer.Controls.Count)
{
foreach (ClassForGettingData data in ClassForGettingData.cheque_list)
{
CustomUsercontrol u = new CustomUsercontrol );
u.chequeInfos(data);
u.PrintToGraphics(e.Graphics,new Point(0,yPos));
yPos += 450;
}
}
else
{
e.HasMorePages = false;
}
}
else
{
numberOfItemsPerPage = 0;
e.HasMorePages = true;
return;
}
}
}
numberOfItemsPerPage = 0;
numberOfItemsPrintedSoFar = 0;
internal void PrintToGraphics(Graphics graphics,Point point)
{
Bitmap bitmap = new Bitmap(this.Width,this.Height);
this.DrawToBitmap(bitmap,new Rectangle(0,bitmap.Width,bitmap.Height));
graphics.PageUnit = GraphicsUnit.Display;
graphics.DrawImage(bitmap,point);
}
但是这段代码的问题是它只在一页文档中打印了所有控件。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)