You have several properties to use, like:
With PrintDialog1
.AllowCurrentPage = True;
.AllowSomePages = True;
.AllowPrintToFile = True;
.AllowSelection = True;
.ShowDialog();
End With
More about:
PrintDialog Class[
^]
PrintDialog Properties[
^]
AllowCurrentPage[
^]
AllowSomePages[
^]
[EDIT]
OK, now i'm getting, what you want.
Please, see below example:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public int numcopies = 0;
public int currcopy = 0;
public string[] strCopy = new string[] {"ORIGINAL COPY", "DUPLICATE COPY","TRIPLICATE COPY","QUADRUPLICATE COPY"};
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
System.Drawing.Printing.PrintDocument pdoc = new System.Drawing.Printing.PrintDocument();
pdoc.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("Custom", 830, 1070);
pdoc.PrinterSettings.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("Custom", 830, 1070); ;
pdoc.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.pdoc_PrintPage);
DialogResult res = DialogResult.Cancel;
System.Windows.Forms.PrintDialog pdlg = new PrintDialog();
pdlg.AllowCurrentPage = true;
pdlg.AllowPrintToFile = true;
pdlg.Document = pdoc;
res = pdlg.ShowDialog();
if (res == DialogResult.OK)
{
numcopies = 4;
};
for (int i = 1; i<numcopies+1 ;i++ )
{
currcopy = i-1;
pdoc.DocumentName = strCopy[currcopy].ToString();
pdoc.Print();
}
}
private void pdoc_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawString(strCopy[currcopy ].ToString(), new Font("Arial", 9, FontStyle.Underline), Brushes.Black, 350, 30);
e.Graphics.DrawString(this.textBox1.Text, new Font("Arial", 10, FontStyle.Italic), Brushes.Black, 30, 30);
e.Graphics.DrawString(this.textBox2.Text, new Font("Arial", 10, FontStyle.Bold), Brushes.Black, 400, 70);
e.Graphics.DrawString(this.textBox3.Text, new Font("Arial", 9), Brushes.Black, new Rectangle(390, 100, 370, 50));
e.Graphics.DrawString(this.textBox4.Text, new Font("Arial", 9), Brushes.Black, 490, 160);
}
}
}
I hope this is what you want ;)
[/EDIT]
[EDIT 2]
Tip/Hint:
It would be great to add custom dialogbox (windows form) with 4 checkboxes:
- oryginal
- 1. copy
- 2. copy
- 3. copy
Depends on user selection, program should print only selected copies.
[/EDIT]