本文整理汇总了C#中System.Windows.Forms.PrintPreviewDialog.Show方法的典型用法代码示例。如果您正苦于以下问题:C# PrintPreviewDialog.Show方法的具体用法?C# PrintPreviewDialog.Show怎么用?C# PrintPreviewDialog.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.PrintPreviewDialog
的用法示例。
在下文中一共展示了PrintPreviewDialog.Show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnPrint_Click
private void btnPrint_Click(object sender, EventArgs e)
{
gcOptions.Visible = false;
using (System.Drawing.Printing.PrintDocument printDocument = new System.Drawing.Printing.PrintDocument())
{
printDocument.PrintPage += printDocument_PrintPage;
printDocument.DefaultPageSettings.Landscape = true;
printDocument.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("FalseX", 500, 1000);
//Resize
Size = new Size(974, 507);
CaptureScreen();
try
{
//printDocument.Print();
PrintPreviewDialog PPdlg = new PrintPreviewDialog() { Document = printDocument };
PPdlg.Show();
}
catch (Exception ex)
{
Program.ShowMsg(ex.Message, true, this);
Program.Logger.LogThis(null, Text, FXFW.Logger.OpType.fail, ex, null, this);
}
}
Size = new Size(974, 589);
gcOptions.Visible = true;
}
示例2: PrintPreviewTree
/// <summary>
/// Shows a PrintPreview dialog displaying the Tree control passed in.
/// </summary>
/// <param name="tree">TreeView to print preview</param>
/// <param name="reportTitle"></param>
public void PrintPreviewTree(TreeView tree, string reportTitle)
{
this.title = reportTitle;
this.PrepareTreeImage(tree);
var pp = new PrintPreviewDialog { Document = this.printDoc };
pp.Show();
}
示例3: PrintReport
public void PrintReport(DataGridView dGrid)
{
this.dGrid = dGrid;
pDoc = new PrintDocument();
pDoc.PrintPage += new PrintPageEventHandler(pDoc_PrintPage);
pPreviewDialog = new PrintPreviewDialog();
pPreviewDialog.Document = pDoc;
pPreviewDialog.Show();
pDoc.Print();
}
示例4: btnImprimir_Click
// Um para imprimir aqui estou usando o sistema de impressão basico do .Net
private void btnImprimir_Click(object sender, EventArgs e)
{
// criando um documento de impressão
// para que eu mande os objeto serem renderizados neste.
PrintDocument pDoc = new PrintDocument();
PrintPreviewDialog ppw = new PrintPreviewDialog();
pDoc.PrintPage += new PrintPageEventHandler(pDoc_PrintPage);
ppw.Document = pDoc;
ppw.MdiParent = this.MdiParent;
ppw.WindowState = FormWindowState.Maximized;
ppw.Show();
}
示例5: PrintPreview
public static void PrintPreview(IPrintable printable)
{
using (PrintDocument pdoc = printable.PrintDocument) {
if (pdoc != null) {
PrintPreviewDialog ppd = new PrintPreviewDialog();
ppd.TopMost = true;
ppd.Document = pdoc;
ppd.Show(WorkbenchSingleton.MainWin32Window);
} else {
MessageService.ShowError("${res:ICSharpCode.SharpDevelop.Commands.Print.CreatePrintDocumentError}");
}
}
}
示例6: Button1Click
/*------------------------------------------*/
void Button1Click(object sender, EventArgs e)
{
_dataSet.Clear();
_dataSet.DataSetName = "journal";
_mySQL.SelectSqlCommand = "SELECT * FROM journal WHERE (journal_date BETWEEN '" + dateTimePicker1.Text + "' AND '" + dateTimePicker2.Text + "' AND journal_firm_seller = '" + textBox3.Text + "' AND journal_type = 'Приходная Накладная' AND journal_delete = 0)";
if(_mySQL.ExecuteFill(_dataSet, "journal")){
// ФОРМИРУЕМ ОТЧЁТ
PrintPreviewDialog ppd = new PrintPreviewDialog();
ppd.Document = printDocument1;
ppd.MdiParent = ClassForms.Rapid_Client;
ppd.Show();
}else ClassForms.Rapid_Client.MessageConsole("Отчёт Оборотная ведомость по торг. представителю: Ошибка вывода информации.", true);
}
示例7: Button1Click
void Button1Click(object sender, EventArgs e)
{
_dataSet.Clear();
_dataSet.DataSetName = "operations";
_mySQL.SelectSqlCommand = "SELECT operations.*, journal.* FROM operations, journal WHERE (operations_date BETWEEN '" + dateTimePicker1.Text + "' AND '" + dateTimePicker2.Text + "' AND (operations_DT = " + textBox3.Text + " OR operations_KT = " + textBox3.Text + ") AND (journal.journal_id_doc = operations.operations_id_doc)) ORDER BY operations_date ASC";
if(_mySQL.ExecuteFill(_dataSet, "operations")){
// ФОРМИРУЕМ ОТЧЁТ
PrintPreviewDialog ppd = new PrintPreviewDialog();
ppd.Document = printDocument1;
ppd.MdiParent = ClassForms.Rapid_Client;
ppd.Show();
}else ClassForms.Rapid_Client.MessageConsole("Отчёт Оборотная ведомость по счёту: Ошибка вывода информации.", true);
}
示例8: Button1Click
void Button1Click(object sender, EventArgs e)
{
_dataSet.Clear();
_dataSet.DataSetName = "balance";
if(checkBox1.Checked){
_mySQL.SelectSqlCommand = "SELECT * FROM balance ORDER BY balance_tmc ASC";
}else _mySQL.SelectSqlCommand = "SELECT * FROM balance WHERE (balance_date BETWEEN '" + dateTimePicker1.Text + "' AND '" + dateTimePicker2.Text + "') ORDER BY balance_tmc ASC";
if(_mySQL.ExecuteFill(_dataSet, "balance")){
// ФОРМИРУЕМ ОТЧЁТ
PrintPreviewDialog ppd = new PrintPreviewDialog();
ppd.Document = printDocument1;
ppd.MdiParent = ClassForms.Rapid_Client;
ppd.Show();
}else ClassForms.Rapid_Client.MessageConsole("Отчёт Остатки ТМЦ: Ошибка вывода информации.", true);
}
示例9: Run
public override void Run()
{
try {
IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
if (window != null) {
if (window.ViewContent is IPrintable) {
using (PrintDocument pdoc = ((IPrintable)window.ViewContent).PrintDocument) {
if (pdoc != null) {
PrintPreviewDialog ppd = new PrintPreviewDialog();
ppd.Owner = (Form)WorkbenchSingleton.Workbench;
ppd.TopMost = true;
ppd.Document = pdoc;
ppd.Show();
} else {
MessageService.ShowError("${res:ICSharpCode.SharpDevelop.Commands.Print.CreatePrintDocumentError}");
}
}
}
}
} catch (InvalidPrinterException) {}
}
示例10: toolStripPrintLittleEnv_Click
private void toolStripPrintLittleEnv_Click(object sender, EventArgs e)
{
print_doc = new PrintDocument();
print_doc.PrintPage += delegate(object o, PrintPageEventArgs pe)
{
using (SolidBrush brush = new SolidBrush(Color.Black))
{
using (Font font = new Font("Tahoma", 12f))
{
int line_start = 140;
int line_height = (font.Height * 2) - 5;
int line_multi = 0;
pe.Graphics.DrawString("กรุณาส่ง", font, brush, new Point(190, line_start));
pe.Graphics.DrawString(this.dealer.contact, font, brush, new Point(280, line_start + (line_height * ++line_multi)));
pe.Graphics.DrawString((this.dealer.prenam.Length > 0 ? this.dealer.prenam + " " + this.dealer.compnam : this.dealer.compnam), font, brush, new Point(280, line_start + (line_height * ++line_multi)));
pe.Graphics.DrawString(this.dealer.addr01, font, brush, new Point(280, line_start + (line_height * ++line_multi)));
pe.Graphics.DrawString(this.dealer.addr02 + " " + this.dealer.addr03, font, brush, new Point(280, line_start + (line_height * ++line_multi)));
pe.Graphics.DrawString(this.dealer.zipcod, font, brush, new Point(280, line_start + (line_height * ++line_multi)));
}
}
};
PageSetupDialog page_setup = new PageSetupDialog();
page_setup.Document = this.print_doc;
page_setup.PageSettings.PaperSize = new PaperSize("Little Envelope", 910, 425);
PrintOutputSelection wind = new PrintOutputSelection();
if (wind.ShowDialog() == DialogResult.OK)
{
if (wind.output == PrintOutputSelection.OUTPUT.PRINTER)
{
PrintDialog print_dialog = new PrintDialog();
print_dialog.Document = this.print_doc;
print_dialog.AllowSelection = false;
print_dialog.AllowSomePages = false;
print_dialog.AllowPrintToFile = false;
print_dialog.AllowCurrentPage = false;
print_dialog.UseEXDialog = true;
if (print_dialog.ShowDialog() == DialogResult.OK)
{
print_doc.Print();
}
}
if (wind.output == PrintOutputSelection.OUTPUT.SCREEN)
{
PrintPreviewDialog preview_dialog = new PrintPreviewDialog();
preview_dialog.Document = this.print_doc;
preview_dialog.MdiParent = this.main_form;
preview_dialog.Show();
}
if (wind.output == PrintOutputSelection.OUTPUT.FILE)
{
}
}
else
{
print_doc = null;
page_setup = null;
}
}
示例11: toolStripPrintLabel3Col_Click
private void toolStripPrintLabel3Col_Click(object sender, EventArgs e)
{
print_doc = new PrintDocument();
PageSetupDialog page_setup = new PageSetupDialog();
page_setup.Document = this.print_doc;
//page_setup.PageSettings.PaperSize = new PaperSize("Sticker 2 column", 825, 1165);
page_setup.PageSettings.PaperSize = new PaperSize("Sticker 3 column", 1250, 1195);
page_setup.PageSettings.Margins = new Margins(0, 0, 0, 0);
PrintDealerLabelOutputSelection wind = new PrintDealerLabelOutputSelection(this.main_form);
wind.txtFrom.Text = this.dealer.dealer;
wind.txtTo.Text = this.dealer.dealer;
if (wind.ShowDialog() == DialogResult.OK)
{
int row_num = 0;
int page_count = 0;
List<Dealer> list_dealer = new List<Dealer>();
print_doc.BeginPrint += delegate(object o, PrintEventArgs pe)
{
string json_data = "{\"dealer_from\":\"" + wind.dealer_from + "\",";
json_data += "\"dealer_to\":\"" + wind.dealer_to + "\",";
json_data += "\"condition\":\"" + wind.condition + "\"}";
CRUDResult get = ApiActions.POST(PreferenceForm.API_MAIN_URL() + "dealer/get_for_print_label", json_data);
ServerResult sr = JsonConvert.DeserializeObject<ServerResult>(get.data);
if (sr.result == ServerResult.SERVER_RESULT_SUCCESS)
{
if (sr.dealer.Count > 0)
{
list_dealer = sr.dealer;
}
else
{
MessageAlert.Show(StringResource.NO_DATA_IN_RANGE, "Error", MessageAlertButtons.OK, MessageAlertIcons.ERROR);
return;
}
}
else
{
MessageAlert.Show(sr.message, "Error", MessageAlertButtons.OK, MessageAlertIcons.ERROR);
return;
}
row_num = 0;
page_count = 0;
};
print_doc.PrintPage += delegate(object o, PrintPageEventArgs pe)
{
using (Font font = new Font("Tahoma", 9.75f))
{
using (SolidBrush brush = new SolidBrush(Color.Black))
{
//int max_col = 2; // for sticker 2 column
int max_col = 3; // for sticker 3 column
int col_count = 0;
int col_width = 413;
int line_count = 0;
int line_height = 25;
int block_count = 1; // store row number of sticker
int block_height = line_height * 4;
int block_margin_top = 25;
int block_margin_bottom = 25;
page_count++;
int page_row_count = 0;
for (int i = row_num; i < list_dealer.Count; i++)
{
row_num++;
col_count++;
page_row_count++;
if (page_row_count > 1 && i % max_col == 0)
{
col_count = 1;
++block_count;
}
int contact_x = 30 + (col_count * col_width) - col_width;
int contact_y = ((block_count == 1 ? block_margin_top : (block_margin_top + block_margin_bottom) * (block_count - 1))) + ((block_count * block_height) - block_height) + (++line_count * line_height) - line_height;
if (col_count == 1 && Math.Ceiling(Convert.ToDouble(page_row_count / max_col)) * block_height + (block_count * (block_margin_top + block_margin_bottom)) > pe.MarginBounds.Bottom)
{
pe.HasMorePages = true;
page_row_count = 0;
block_count = 1;
row_num--;
return;
}
else
{
pe.HasMorePages = false;
}
pe.Graphics.DrawString("ส่ง", font, brush, new Point(contact_x - 30, contact_y));
//.........这里部分代码省略.........
示例12: toolStripPrint_Click
private void toolStripPrint_Click(object sender, EventArgs e)
{
this.GetNote();
PrintDocument print_doc = new PrintDocument();
PageSetupDialog page_setup = new PageSetupDialog();
page_setup.Document = print_doc;
page_setup.PageSettings.PaperSize = new PaperSize("A4", 825, 1165);
page_setup.PageSettings.Landscape = true;
page_setup.PageSettings.Margins = new Margins(20, 20, 10, 25);
PrintOutputSelection print_out = new PrintOutputSelection();
if (print_out.ShowDialog() == DialogResult.OK)
{
int row_num = 0;
int page_num = 0;
int x = 0;
print_doc.BeginPrint += delegate(object s, PrintEventArgs pe)
{
row_num = 0;
page_num = 0;
};
print_doc.PrintPage += delegate(object s, PrintPageEventArgs pe)
{
int x_pos = pe.MarginBounds.Left;
int y_pos = pe.MarginBounds.Top;
#region declare column width & cell padding
int cell_padding = 3;
int col1 = 30; // seq.
int col2 = 55; // start_time
int col3 = 55; // end_time
int col4 = 55; // duration
int col5 = 80; // S/N
int col6 = 90; // name
int col7 = 30; // map drive
int col8 = 30; // ins./up
int col9 = 30; // error
int col10 = 30; // ins. fonts
int col11 = 30; // printer
int col12 = 30; // training
int col13 = 30; // stock
int col14 = 30; // form
int col15 = 30; // report -> excel
int col16 = 30; // balance sheet/statement
int col17 = 30; // assets
int col18 = 30; // secure
int col19 = 30; // year end
int col20 = 30; // period
int col21 = 30; // mail/wait
int col22 = 30; // transfer -> mkt.
int col23 = 280; // other/remark
#endregion declare column width
bool is_new_page = true;
page_num++;
if (is_new_page) // print report header
{
#region Print report header
StringFormat str_format_center = new StringFormat()
{
//FormatFlags = StringFormatFlags.LineLimit | StringFormatFlags.NoWrap,
//Trimming = StringTrimming.None,
Alignment = StringAlignment.Center,
LineAlignment = StringAlignment.Center
};
StringFormat str_format_right = new StringFormat()
{
//FormatFlags = StringFormatFlags.LineLimit | StringFormatFlags.NoWrap,
//Trimming = StringTrimming.None,
Alignment = StringAlignment.Far,
LineAlignment = StringAlignment.Center
};
StringFormat str_format_left = new StringFormat()
{
//FormatFlags = StringFormatFlags.LineLimit | StringFormatFlags.NoWrap,
//Trimming = StringTrimming.None,
Alignment = StringAlignment.Near,
LineAlignment = StringAlignment.Center
};
// Report header
using (Font font = new Font("tahoma", 15f))
{
using (SolidBrush brush = new SolidBrush(Color.Black))
{
SizeF box_size = pe.Graphics.MeasureString("บันทึกการปฏิบัติงาน", font);
pe.Graphics.DrawString("บันทึกการปฏิบัติงาน", font, brush, new RectangleF(x_pos, y_pos, x_pos + pe.MarginBounds.Right - x_pos, box_size.Height), str_format_center);
}
}
using (Font font = new Font("tahoma", 12f))
{
using (SolidBrush brush = new SolidBrush(Color.Black))
{
//.........这里部分代码省略.........
示例13: PreviewProc
private void PreviewProc(object state)
{
try {
PrintDocument document = (PrintDocument)state;
_previewDialog = new PrintPreviewDialog();
_previewDialog.Text = "DICOM Print Preview";
_previewDialog.ShowInTaskbar = true;
_previewDialog.WindowState = FormWindowState.Maximized;
_previewDialog.Document = document;
_previewDialog.FormClosed += delegate(object sender, FormClosedEventArgs e) {
_previewDialog = null;
};
_previewDialog.Show(Application.OpenForms[0]);
_previewDialog.BringToFront();
_previewDialog.Focus();
} catch (Exception ex) {
#if DEBUG
Dicom.Debug.Log.Error("DICOM Print Error: " + ex.ToString());
#else
Dicom.Debug.Log.Error("DICOM Print Error: " + ex.Message);
#endif
}
}
示例14: choiButton1_Click
private void choiButton1_Click(object sender, EventArgs e)
{
try
{
this.CaptureScreen();
PrintPreviewDialog printPreviewDialog1 = new PrintPreviewDialog();
PrintDocument printDocumnet1 = new PrintDocument();
printDocumnet1.PrintPage += new PrintPageEventHandler(this.printDocument1_PrintPage);
printPreviewDialog1.Document = printDocumnet1;
printPreviewDialog1.Show(this);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
示例15: printPreviewToolStripMenuItem_Click
private void printPreviewToolStripMenuItem_Click(object sender, EventArgs e)
{
hashesToPrint = new Queue<string>(duplicateHashes);
conflictNumber = 0;
this.firstPage = true;
PrintPreviewDialog printPreviewDialog = new PrintPreviewDialog();
printPreviewDialog.Document = printDocument1;
printPreviewDialog.Show();
}