本文整理匯總了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) ;
}