111,077
社区成员




private void button2_Click(object sender, EventArgs e)
{
if (!IsWholeNumber(this.txtNum.Text.Trim()))
{
MessageBox.Show("Please enter a number!", "提交提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
txtNum.Focus();
txtNum.SelectAll();
label8.Visible = true;
return;
}
if (printDialog1.ShowDialog() != DialogResult.Cancel)
{
try
{
printDocument1.Print();
p = 1;
totalNo = 0;
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
printDocument1.Print();
string pname=this.printDialog1.PrinterSettings.PrinterName;
printDocument1.PrinterSettings.PrinterName = pname;
printDialog1.Document = printDocument1;
printDocument1.Print();
string PrinterName = this.printDocument1.PrinterSettings.PrinterName;
//Open the PrintDialog
this.printDialog1.Document = this.printDocument1;
DialogResult dr = this.printDialog1.ShowDialog();
if(dr == DialogResult.OK)
{
//Get the Copy times
int nCopy = this.printDocument1.PrinterSettings.Copies;
//Get the number of Start Page
int sPage = this.printDocument1.PrinterSettings.FromPage;
//Get the number of End Page
int ePage = this.printDocument1.PrinterSettings.ToPage;
string PrinterName = this.printDocument1.PrinterSettings.PrinterName;
this.printDialog1.PrinterSettings.PrinterName
pageSetupDialog1.PageSettings = new System.Drawing.Printing.PageSettings();
if (DialogResult.OK == this.pageSetupDialog1.ShowDialog())
{
this.printDialog1.PrinterSettings = pageSetupDialog1.PrinterSettings;
}