ScriptManager.RegisterClientScriptBlock(this.Page, typeof(string), "print", "window.print();", true);
System.Windows.Controls.PrintDialog dialogue = new System.Windows.Controls.PrintDialog(); DialogResult dr = dialogue.ShowDialog(); if( dr == DialogResult.OK) { // Do something } dialogue.Dispose();
PrintDocument pd = new PrintDocument(); pd.PrintPage += new PrintPageEventHandler(PrintPage); PrintDialog pdi = new PrintDialog(); pdi.Document = pd; if (pdi.ShowDialog() == DialogResult.OK) { pd.DocumentName = documentName; pd.Print(); } else { MessageBox.Show("Print Cancelled"); }
// Configure printer dialog box System.Windows.Controls.PrintDialog dlg = new System.Windows.Controls.PrintDialog(); dlg.PageRangeSelection = PageRangeSelection.AllPages; dlg.UserPageRangeEnabled = true; // Show save file dialog box Nullable<bool> result = dlg.ShowDialog(); // Process save file dialog box results if (result == true) { // Print document }</bool>
PrintDocument item= new PrintDocument(); item.PrintPage += new PrintPageEventHandler(PrintPage); PrintDialog pdi = new PrintDialog(); pdi.Document = item; if (pdi.ShowDialog() == DialogResult.OK) { item.DocumentName = documentName; item.Print(); } else { MessageBox.Show("Print Cancelled"); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)