本文整理汇总了C#中System.Windows.Forms.PageSetupDialog.ShowDialog方法的典型用法代码示例。如果您正苦于以下问题:C# PageSetupDialog.ShowDialog方法的具体用法?C# PageSetupDialog.ShowDialog怎么用?C# PageSetupDialog.ShowDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.PageSetupDialog
的用法示例。
在下文中一共展示了PageSetupDialog.ShowDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowPageSetupDialog
public DialogResult ShowPageSetupDialog()
{
PageSetupDialog psd = new PageSetupDialog();
psd.PageSettings = PageSettings;
psd.PrinterSettings = PageSettings.PrinterSettings;
return psd.ShowDialog();
}
示例2: Print_DataGridView
public static void Print_DataGridView(DataGridView dgv1, string printTitle, bool printAllRows, bool fitToPageWidth)
{
PrintPreviewDialog ppvw;
try
{
// Getting DataGridView object to print
dgv = dgv1;
// Getting all Coulmns Names in the DataGridView
AvailableColumns.Clear();
foreach (DataGridViewColumn c in dgv.Columns)
{
if (!c.Visible) continue;
AvailableColumns.Add(c.HeaderText);
}
// Showing the PrintOption Form
//PrintOptions dlg = new PrintOptions(AvailableColumns);
//if (dlg.ShowDialog() != DialogResult.OK) return;
PrintTitle = printTitle;
PrintAllRows = printAllRows;
FitToPageWidth = fitToPageWidth;
SelectedColumns = AvailableColumns;
RowsPerPage = 0;
ppvw = new PrintPreviewDialog();
PageSetupDialog psd = new PageSetupDialog();
psd.Document = printDoc;
psd.ShowDialog();
printDoc.DefaultPageSettings = psd.PageSettings;
ppvw.Document = printDoc;
// Showing the Print Preview Page
printDoc.BeginPrint += new System.Drawing.Printing.PrintEventHandler(PrintDoc_BeginPrint);
printDoc.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(PrintDoc_PrintPage);
//printDoc.QueryPageSettings += new System.Drawing.Printing.QueryPageSettingsEventHandler(printDoc_QueryPageSettings);
if (ppvw.ShowDialog() != DialogResult.OK)
{
printDoc.BeginPrint -= new System.Drawing.Printing.PrintEventHandler(PrintDoc_BeginPrint);
printDoc.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(PrintDoc_PrintPage);
return;
}
// Printing the Documnet
printDoc.Print();
printDoc.BeginPrint -= new System.Drawing.Printing.PrintEventHandler(PrintDoc_BeginPrint);
printDoc.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(PrintDoc_PrintPage);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
}
}
示例3: StartPrint
//Stream streamToPrint, string streamType
//2�����Print��ӡ����
public void StartPrint()
{
//����ֵ��PageSettings A4\A5
PageSettings ps = new PageSettings();
//��ʾ���ô�ӡҳ�Ի���
PageSetupDialog Psdl = new PageSetupDialog();
//��ӡ������ã�ע�⣬�÷��������printpage�������档
PrintDialog pt = new PrintDialog();
pt.AllowCurrentPage = true;
pt.AllowSomePages = true;
pt.AllowPrintToFile = true;
// StreamToPrint = streamToPrint;//��ӡ���ֽ���
// StreamType = streamType; //��ӡ������
// printDocument1.DocumentName = Filename; //��ӡ���ļ���
Psdl.Document = printDocument1;
// PrintPreview.Document = printDocument1;
pt.Document = printDocument1;
Psdl.PageSettings = printDocument1.DefaultPageSettings;
try
{
//ҳ�����öԻ���
if (Psdl.ShowDialog() == DialogResult.OK)
{
ps = Psdl.PageSettings;
printDocument1.DefaultPageSettings = Psdl.PageSettings;
}
//ѡ���ӡ���Ի���
if (pt.ShowDialog() == DialogResult.OK)
{
printDocument1.PrinterSettings.Copies = pt.PrinterSettings.Copies;
//printDocument1.Print();
if (!checkBoxAll.Checked)
{
printDocument1.Print();
}
else
{
for (int i = 0; i < dataGridView1.RowCount; i++)
{
ShowTag(i);
printDocument1.Print();
}
}
}
////��ӡԤ���Ի���
//if (PrintPreview.ShowDialog() == DialogResult.OK)
//{
// //���ô�ӡ
// printDocument1.Print();
//}
//PrintDocument�����Print()������PrintController����ִ��PrintPage�¼���
}
catch (InvalidPrinterException ex)
{
MessageBox.Show(ex.Message, "Simple Editor", MessageBoxButtons.OK, MessageBoxIcon.Error);
throw;
}
}
示例4: DoPageSetup
/// <summary>
/// Display a <see cref="PageSetupDialog" /> to the user, allowing them to modify
/// the print settings for this <see cref="ZedGraphControl" />.
/// </summary>
public void DoPageSetup()
{
PrintDocument pd = PrintDocument;
// Add a try/catch pair since the users of the control can't catch this one
try {
if (pd != null) {
//pd.PrintPage += new PrintPageEventHandler( GraphPrintPage );
PageSetupDialog setupDlg = new PageSetupDialog();
setupDlg.Document = pd;
if (setupDlg.ShowDialog() == DialogResult.OK) {
pd.PrinterSettings = setupDlg.PrinterSettings;
pd.DefaultPageSettings = setupDlg.PageSettings;
// BUG in PrintDocument!!! Converts in/mm repeatedly
// http://support.microsoft.com/?id=814355
// from http://www.vbinfozine.com/tpagesetupdialog.shtml, by Palo Mraz
//if ( System.Globalization.RegionInfo.CurrentRegion.IsMetric )
//{
// setupDlg.Document.DefaultPageSettings.Margins = PrinterUnitConvert.Convert(
// setupDlg.Document.DefaultPageSettings.Margins,
// PrinterUnit.Display, PrinterUnit.TenthsOfAMillimeter );
//}
}
}
}
catch (Exception exception) {
MessageBox.Show(exception.Message);
}
}
示例5: ShowPageSettingsDialog
/// <summary>
/// Shows the page settings dialog</summary>
public void ShowPageSettingsDialog()
{
PageSetupDialog pageSetupDialog = new PageSetupDialog();
PrintDocument printDocument = GetPrintDocument();
pageSetupDialog.Document = printDocument;
pageSetupDialog.ShowDialog();
}
示例6: ShowPageSetupDialog
public DialogResult ShowPageSetupDialog(ScintillaPrintDocument doc)
{
var psd = new PageSetupDialog();
psd.AllowPrinter = true;
psd.PageSettings = doc.DefaultPageSettings;
psd.PrinterSettings = doc.DefaultPageSettings.PrinterSettings;
return psd.ShowDialog(WB.Form);
}
示例7: filePageSetupMenuItem_Click
public void filePageSetupMenuItem_Click(Object sender, EventArgs e)
{
PageSetupDialog pageSetupDialog = new PageSetupDialog();
pageSetupDialog.PageSettings = _pageSettings;
pageSetupDialog.PrinterSettings = _printSettings;
pageSetupDialog.AllowOrientation = true;
pageSetupDialog.AllowMargins = true;
pageSetupDialog.ShowDialog();
}
示例8: PageSetupDialog
void IPrinter.ShowPageSettings()
{
PageSetupDialog pageSetupDialog = new PageSetupDialog();
pageSetupDialog.PageSettings = pgSettings;
pageSetupDialog.PrinterSettings = prtSettings;
pageSetupDialog.AllowOrientation = true;
pageSetupDialog.AllowMargins = true;
pageSetupDialog.ShowDialog();
}
示例9: PageSetupButton_Click
private void PageSetupButton_Click(object sender, EventArgs e)
{
PageSetupDialog pageSetupDialog = new PageSetupDialog();
pageSetupDialog.PageSettings = m_DocumentPageSettings;
if (pageSetupDialog.ShowDialog() == DialogResult.OK)
{
m_DocumentPageSettings = pageSetupDialog.PageSettings;
}
}
示例10: button3_Click
private void button3_Click(object sender, EventArgs e)
{
PageSetupDialog pageSetupDialog = new PageSetupDialog();
pageSetupDialog.PageSettings = pgSettings;
pageSetupDialog.PrinterSettings = prtSettings;
pageSetupDialog.AllowOrientation = true;
pageSetupDialog.AllowMargins = true;
pageSetupDialog.ShowDialog();
pd.PrinterSettings = prtSettings;
pd.DefaultPageSettings = pgSettings;
}
示例11: TestPrint
public void TestPrint()
{
PrintDocument document = new PrintDocument();
document.PrintPage += new PrintPageEventHandler(Document_PrintPage);
PageSetupDialog setup_dialog = new PageSetupDialog();
setup_dialog.Document = document;
setup_dialog.ShowDialog();
PrintPreviewDialog preview_dialog = new PrintPreviewDialog();
preview_dialog.Document = document;
//document.DefaultPageSettings.Landscape = true;
preview_dialog.ShowDialog();
}
示例12: EditPrintSettings
// Edit the print settings.
public void EditPrintSettings()
{
// Show the page setup dialog
PageSetupDialog pageSetupDialog = new PageSetupDialog();
pageSetupDialog.PageSettings = _pageSettings;
pageSetupDialog.PrinterSettings = _printerSettings;
pageSetupDialog.ShowNetwork = false;
if (pageSetupDialog.ShowDialog() == DialogResult.OK)
{
_pageSettings = pageSetupDialog.PageSettings;
_printerSettings = pageSetupDialog.PrinterSettings;
}
}
示例13: PageSetupDialog
void IPrintService.ConfigurePrintSettings()
{
PageSetupDialog dialog = new PageSetupDialog();
dialog.PageSettings = this.PageSettings;
dialog.PrinterSettings = this.PageSettings.PrinterSettings;
dialog.ShowHelp = false;
try
{
dialog.ShowDialog();
}
catch (Exception exception)
{
MessageBox.Show("Unable to open print settings.\n\nDetails:\n" + exception.Message, "Print Setttings");
}
}
示例14: btn_PageSetup_Click
private void btn_PageSetup_Click(object sender, EventArgs e)
{
try
{
PageSetupDialog psetup = new PageSetupDialog();
if (this.m_PageSetting == null)
this.m_PageSetting = new PageSettings();
psetup.PageSettings = this.m_PageSetting;
psetup.ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
示例15: pageSteToolStripMenuItem_Click
/// <summary>
/// 页面设置事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void pageSteToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
PageSetupDialog setupDialog = new PageSetupDialog();
if (storedPageSettings == null)
storedPageSettings = new PageSettings();
setupDialog.PageSettings = storedPageSettings;
setupDialog.ShowDialog();
}
catch (Exception exception)
{
MessageBox.Show(exception.Message);
}
}