[code] private void btnPrint_Click(object _sender, EventArgs args)
{
PrintPreviewDialog ppd = new PrintPreviewDialog();
ppd.Document = printdocument;
ppd.ClientSize = new Size(900, 600);
ppd.ShowIcon = true;
ppd.Icon = new Icon(Assembly.GetEntryAssembly().GetManifestResourceStream("Konak.Desktop.Images.SBCM.ICO"));
ppd.StartPosition = FormStartPosition.CenterScreen;
ppd.Document.DocumentName = "Transfer Islem Bilgileri";
this.printdocument.PrintPage += (s, a) => { printdocument_PrintPage(s, a); };
ppd.ShowDialog();
}
private void printdocument_PrintPage(object S, PrintPageEventArgs a)
{
float leftMargin = a.MarginBounds.Left;
float topMargin = a.MarginBounds.Top;
int count = 0;
List<string> lst = new List<string>();
for (int i = 0; i < listboxInfoList.Items.Count; i++)
{
a.Graphics.DrawString(listboxInfoList.Items[i].ToString(), this.Font, Brushes.Black, leftMargin, topMargin + count * this.Font.GetHeight(a.Graphics), new StringFormat());
lst.Add(listboxInfoList.Items[i].ToString());
count++;
}
if (!(count >= lst.Count - 1))
{
a.HasMorePages = true;
}
else
{
a.HasMorePages = false;
}
}[/code]
">
[code] private void btnPrint_Click(object _sender, EventArgs args)
{
PrintPreviewDialog ppd = new PrintPreviewDialog();
ppd.Document = printdocument;
ppd.ClientSize = new Size(900, 600);
ppd.ShowIcon = true;
ppd.Icon = new Icon(Assembly.GetEntryAssembly().GetManifestResourceStream("Konak.Desktop.Images.SBCM.ICO"));
ppd.StartPosition = FormStartPosition.CenterScreen;
ppd.Document.DocumentName = "Transfer Islem Bilgileri";
this.printdocument.PrintPage += (s, a) => { printdocument_PrintPage(s, a); };
ppd.ShowDialog();
}
private void printdocument_PrintPage(object S, PrintPageEventArgs a)
{
float leftMargin = a.MarginBounds.Left;
float topMargin = a.MarginBounds.Top;
int count = 0;
List<string> lst = new List<string>();
for (int i = 0; i < listboxInfoList.Items.Count; i++)
{
a.Graphics.DrawString(listboxInfoList.Items[i].ToString(), this.Font, Brushes.Black, leftMargin, topMargin + count * this.Font.GetHeight(a.Graphics), new StringFormat());
lst.Add(listboxInfoList.Items[i].ToString());
count++;
}
if (!(count >= lst.Count - 1))
{
a.HasMorePages = true;
}
else
{
a.HasMorePages = false;
}
}[/code]
">
[code] private void btnPrint_Click(object _sender, EventArgs args)
{
PrintPreviewDialog ppd = new PrintPreviewDialog();
ppd.Document = printdocument;
ppd.ClientSize = new Size(900, 600);
ppd.ShowIcon = true;
ppd.Icon = new Icon(Assembly.GetEntryAssembly().GetManifestResourceStream("Konak.Desktop.Images.SBCM.ICO"));
ppd.StartPosition = FormStartPosition.CenterScreen;
ppd.Document.DocumentName = "Transfer Islem Bilgileri";
this.printdocument.PrintPage += (s, a) => { printdocument_PrintPage(s, a); };
ppd.ShowDialog();
}
private void printdocument_PrintPage(object S, PrintPageEventArgs a)
{
float leftMargin = a.MarginBounds.Left;
float topMargin = a.MarginBounds.Top;
int count = 0;
List<string> lst = new List<string>();
for (int i = 0; i < listboxInfoList.Items.Count; i++)
{
a.Graphics.DrawString(listboxInfoList.Items[i].ToString(), this.Font, Brushes.Black, leftMargin, topMargin + count * this.Font.GetHeight(a.Graphics), new StringFormat());
lst.Add(listboxInfoList.Items[i].ToString());
count++;
}
if (!(count >= lst.Count - 1))
{
a.HasMorePages = true;
}
else
{
a.HasMorePages = false;
}
}[/code]
">
[code] private void btnPrint_Click(object _sender, EventArgs args)
{
PrintPreviewDialog ppd = new PrintPreviewDialog();
ppd.Document = printdocument;
ppd.ClientSize = new Size(900, 600);
ppd.ShowIcon = true;
ppd.Icon = new Icon(Assembly.GetEntryAssembly().GetManifestResourceStream("Konak.Desktop.Images.SBCM.ICO"));
ppd.StartPosition = FormStartPosition.CenterScreen;
ppd.Document.DocumentName = "Transfer Islem Bilgileri";
this.printdocument.PrintPage += (s, a) => { printdocument_PrintPage(s, a); };
ppd.ShowDialog();
}
private void printdocument_PrintPage(object S, PrintPageEventArgs a)
{
float leftMargin = a.MarginBounds.Left;
float topMargin = a.MarginBounds.Top;
int count = 0;
List<string> lst = new List<string>();
for (int i = 0; i < listboxInfoList.Items.Count; i++)
{
a.Graphics.DrawString(listboxInfoList.Items[i].ToString(), this.Font, Brushes.Black, leftMargin, topMargin + count * this.Font.GetHeight(a.Graphics), new StringFormat());
lst.Add(listboxInfoList.Items[i].ToString());
count++;
}
if (!(count >= lst.Count - 1))
{
a.HasMorePages = true;
}
else
{
a.HasMorePages = false;
}
}[/code]
JLCPCB – Prototype 10 PCBs for $2 (For Any Color)
China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w