I need to get the checked rows values and print them (2 rows per page sequentially ordered like in the gridview) till print all checked rows it works fine
in this code below but I need to load this list from datagridview and the values from each checked row!
List<string>CheckedValues=newList<string>();privatevoid button1_Click(object sender,EventArgs e){CheckedValues=newList<string>{"value1","value2","value5","value8","value10","value11"}; printDocument1.Print();}int currentPrintingIndex =0;privatevoid printDocument1_PrintPage(object sender,System.Drawing.Printing.PrintPageEventArgs e){//Width of output labelsvar d=this.printDocument1.DefaultPageSettings.PrintableArea.Width/2;//Print first output labelif(CheckedValues.Count> currentPrintingIndex){var currentValue =CheckedValues[currentPrintingIndex]; e.Graphics.DrawString(currentValue.ToString(),this.Font,newSolidBrush(this.ForeColor),newRectangleF(0,0, d,this.printDocument1.DefaultPageSettings.PrintableArea.Height)); currentPrintingIndex +=1;}//Print second output labelif(CheckedValues.Count> currentPrintingIndex){var currentValue =CheckedValues[currentPrintingIndex]; e.Graphics.DrawString(currentValue.ToString(),this.Font,newSolidBrush(this.ForeColor),newRectangleF( d,0, d,this.printDocument1.DefaultPageSettings.PrintableArea.Height)); currentPrintingIndex +=1;}//If there is more item to print, go to next page e.HasMorePages=CheckedValues.Count> currentPrintingIndex;
↧
How to Change the element to in this list and change the Values "value1,value2..." to get programmatically from each checked row?
↧