我想打印一个按测量属性排序的测量列表(afmetingen),你可以用(toestel)测量它。所以我使用组加入来查找所有正确的测量,并将其放在测量属性组中。现在第一页没问题,但是当我来到页面末尾时(没有足够的空间)我检测到它并且不打印其余部分。
所以我将 ev.getmorepages 设置为 true,以便它在第二页重新开始。但我不必打印前 10 个测量值。如何跳过前 10 次测量?
跳过选项不起作用...
现在有没有办法从测量列表中的某个索引开始?跳过它的前 10 个。
private void pd_PrintPageV2(object sender, PrintPageEventArgs ev)
{
var afmetinger =
from selectoestel in toestel
orderby selectoestel.Volgnr
where selectoestel.IDnumber >= meettoestel
join metinger in tempmeetrapport.afmetingen on selectoestel.IDnumber equals metinger.meettoestel into metinggroup
select new
{
//select toestel naam
toestel = selectoestel.naam,
volgnr = selectoestel.IDnumber,
//select de volledig afmeting
afmetingers = from prod2 in metinggroup
orderby prod2.nummer
select prod2
};
int i = 0;
//code to print the measurement attribute on the page (deleted (to long))
//start printing all measurements row by row
foreach (var productGroup in afmetinger)
{
foreach (var prodItem in productGroup.afmetingers)
{
if(i < 10){ print something on page }
i++
}
}
// If more lines exist, print another page.
if (i>10)
{
ev.HasMorePages = true;
} }