本文整理汇总了C#中System.Windows.Forms.PageSetupDialog类的典型用法代码示例。如果您正苦于以下问题:C# PageSetupDialog类的具体用法?C# PageSetupDialog怎么用?C# PageSetupDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PageSetupDialog类属于System.Windows.Forms命名空间,在下文中一共展示了PageSetupDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrintClass
/// <summary>
/// 打印信息的初始化
/// </summary>
/// <param datagrid="DataGridView">打印数据</param>
/// <param PageS="int">纸张大小</param>
/// <param lendscape="bool">是否横向打印</param>
public PrintClass(DataGridView datagrid, int PageS, bool lendscape)
{
this.datagrid = datagrid;//获取打印数据
this.PageSheet = PageS;//纸张大小
printdocument = new PrintDocument();//实例化PrintDocument类
pagesetupdialog = new PageSetupDialog();//实例化PageSetupDialog类
pagesetupdialog.Document = printdocument;//获取当前页的设置
printpreviewdialog = new PrintPreviewDialog();//实例化PrintPreviewDialog类
printpreviewdialog.Document = printdocument;//获取预览文档的信息
printpreviewdialog.FormBorderStyle = FormBorderStyle.Fixed3D;//设置窗体的边框样式
//横向打印的设置
if (PageSheet >= 0)
{
if (lendscape == true)
{
printdocument.DefaultPageSettings.Landscape = lendscape;//横向打印
}
else
{
printdocument.DefaultPageSettings.Landscape = lendscape;//纵向打印
}
}
pagesetupdialog.Document = printdocument;
printdocument.PrintPage += new PrintPageEventHandler(this.printdocument_printpage);//事件的重载
}
示例2: 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);
}
}
示例3: ShowPageSetupDialog
public DialogResult ShowPageSetupDialog()
{
PageSetupDialog psd = new PageSetupDialog();
psd.PageSettings = PageSettings;
psd.PrinterSettings = PageSettings.PrinterSettings;
return psd.ShowDialog();
}
示例4: 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
{
}
}
示例5: 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;
}
}
示例6: ShowPageSettingsDialog
/// <summary>
/// Shows the page settings dialog</summary>
public void ShowPageSettingsDialog()
{
PageSetupDialog pageSetupDialog = new PageSetupDialog();
PrintDocument printDocument = GetPrintDocument();
pageSetupDialog.Document = printDocument;
pageSetupDialog.ShowDialog();
}
示例7: 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);
}
示例8: ShowPageSetupDialog
public DialogResult ShowPageSetupDialog(IWin32Window owner)
{
PageSetupDialog psd = new PageSetupDialog();
psd.AllowPrinter = true;
psd.PageSettings = PageSettings;
psd.PrinterSettings = PageSettings.PrinterSettings;
return psd.ShowDialog(owner);
}
示例9: 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();
}
示例10: PageSetupDialog
void IPrinter.ShowPageSettings()
{
PageSetupDialog pageSetupDialog = new PageSetupDialog();
pageSetupDialog.PageSettings = pgSettings;
pageSetupDialog.PrinterSettings = prtSettings;
pageSetupDialog.AllowOrientation = true;
pageSetupDialog.AllowMargins = true;
pageSetupDialog.ShowDialog();
}
示例11: InvoiceDocumentPrinter
public InvoiceDocumentPrinter()
{
pDoc = new PrintDocument();
pSDlg = new PageSetupDialog();
pDlg = new PrintDialog();
pDoc.PrintPage += new PrintPageEventHandler(print_material);
pSDlg.Document = pDoc;
pDlg.Document = pDoc;
}
示例12: 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;
}
}
示例13: _btnPageSetup_Click
private void _btnPageSetup_Click(object sender, EventArgs e)
{
using (PageSetupDialog dialog = new PageSetupDialog())
{
dialog.Document = this.Document;
if (dialog.ShowDialog(this) == DialogResult.OK)
{
this._preview.method_2();
}
}
}
示例14: 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;
}
示例15: Install
public static void Install ()
{ PrintDoc = new PrintDocument () ;
SetupDlg = new PageSetupDialog () ;
PreviewDlg = new PrintPreviewDialog () ;
PrintDlg = new PrintDialog () ;
SetupDlg.Document = PrintDoc ;
PreviewDlg.Document = PrintDoc ;
PrintDlg.Document = PrintDoc ;
PrintDoc.PrintPage += new PrintPageEventHandler (OnPrintPage) ;
}