本文整理汇总了C#中System.Drawing.Printing.PageSettings类的典型用法代码示例。如果您正苦于以下问题:C# PageSettings类的具体用法?C# PageSettings怎么用?C# PageSettings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PageSettings类属于System.Drawing.Printing命名空间,在下文中一共展示了PageSettings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CloneTest
public void CloneTest ()
{
// Check for installed printers, because we need
// to have at least one to test
if (PrinterSettings.InstalledPrinters.Count == 0)
Assert.Ignore ("No printers found.");
PageSettings ps = new PageSettings ();
ps.Color = false;
ps.Landscape = true;
ps.Margins = new Margins (120, 130, 140, 150);
ps.PaperSize = new PaperSize ("My Custom Size", 222, 333);
PageSettings clone = (PageSettings) ps.Clone ();
Assert.AreEqual (ps.Color, clone.Color, "#1");
Assert.AreEqual (ps.Landscape, clone.Landscape, "#2");
Assert.AreEqual (ps.Margins, clone.Margins, "#3");
Assert.AreSame (ps.PrinterSettings, clone.PrinterSettings, "#4");
// PaperSize
Assert.AreEqual (ps.PaperSize.PaperName, clone.PaperSize.PaperName, "#5");
Assert.AreEqual (ps.PaperSize.Width, clone.PaperSize.Width, "#6");
Assert.AreEqual (ps.PaperSize.Height, clone.PaperSize.Height, "#7");
Assert.AreEqual (ps.PaperSize.Kind, clone.PaperSize.Kind, "#8");
// PrinterResolution
Assert.AreEqual (ps.PrinterResolution.X, clone.PrinterResolution.X, "#9");
Assert.AreEqual (ps.PrinterResolution.Y, clone.PrinterResolution.Y, "#10");
Assert.AreEqual (ps.PrinterResolution.Kind, clone.PrinterResolution.Kind, "#11");
// PaperSource
Assert.AreEqual (ps.PaperSource.Kind, clone.PaperSource.Kind, "#12");
Assert.AreEqual (ps.PaperSource.SourceName, clone.PaperSource.SourceName, "#13");
}
示例2: ItopVectorControl
public ItopVectorControl()
{
//int num1;
this.components = null;
this.pageSetting=new PageSettings();
this.svgDocument = new SvgDocument();
this.mainIcon = null;
this.roots = new Hashtable(0x10);
this.unnamed = string.Empty;
this.InitializeComponent();
this.mainIcon = this.GetIconFromResource(base.GetType(), "ItopVector.ItopVectorControl.Resource.main.ico");
this.CreateMenu();
this.drawArea1.OperationChanged += new EventHandler(this.ChangeOperation);
this.drawArea1.ScaleChanged += new EventHandler(this.ChangeScale);
this.drawArea1.OnTrackPopup += new TrackPopupEventHandler(this.TrackPopup);
this.drawArea1.OnTipEvent += new OnTipEventHandler(this.ToolTip);
this.drawArea1.PostBrushEvent += new PostBrushEventHandler(this.PostBrush);
this.drawArea1.LeftClick +=new SvgElementEventHandler(drawArea1_LeftClick);
this.drawArea1.DoubleLeftClick+=new SvgElementEventHandler(drawArea1_DoubleLeftClick);
this.drawArea1.RightClick+=new SvgElementEventHandler(drawArea1_RightClick);
this.drawArea1.MoveOver+=new SvgElementEventHandler(drawArea1_MoveOver);
this.drawArea1.MoveIn+=new SvgElementEventHandler(drawArea1_MoveIn);
this.drawArea1.MoveOut+=new SvgElementEventHandler(drawArea1_MoveOut);
this.drawArea1.DragAndDrop+=new DragEventHandler(drawArea1_DragDrop);
this.drawArea1.PaintMap+=new PaintMapEventHandler(drawArea1_PaintMap);
this.drawArea1.AfterPaintPage+=new PaintMapEventHandler(drawArea1_AfterPaintPage);
this.Disposed+=new EventHandler(DocumentControl_Disposed);
this.UpdateProperty();
this.unnamed = ItopVector.Resource.LayoutManager.GetLabelForName("unnamedelement").Trim();
this.drawArea1.OnMouseUp += new MouseEventHandler(drawArea1_OnMouseUp);
}
示例3: PrintPageEventArgs
public PrintPageEventArgs(Graphics graphics, Rectangle marginBounds,
Rectangle pageBounds, PageSettings pageSettings) {
this.graphics = graphics;
this.marginBounds = marginBounds;
this.pageBounds = pageBounds;
this.pageSettings = pageSettings;
}
示例4: 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;
}
}
示例5: Payments_Full_Report_Load
private void Payments_Full_Report_Load(object sender, EventArgs e)
{
ReportDataSource ds = new ReportDataSource();
ds.Name = "DataSet1";
ds.Value = GeneratePaymentData();
this.reportViewer1.ProcessingMode = ProcessingMode.Local;
this.reportViewer1.LocalReport.ReportPath = @"Report5.rdlc";
this.reportViewer1.LocalReport.DataSources.Add(ds);
System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings();
pg.Margins.Top = 0;
pg.Landscape = true;
pg.Margins.Bottom = 0;
pg.Margins.Left = 50;
pg.Margins.Right = 0;
System.Drawing.Printing.PaperSize size = new PaperSize();
size.RawKind = (int)PaperKind.A4;
pg.PaperSize = size;
pg.Landscape = true;
this.reportViewer1.SetPageSettings(pg);
this.reportViewer1.RefreshReport();
}
示例6: GdiPrinterPrintAction
private bool GdiPrinterPrintAction(int pageIndex, Graphics graphics, Rectangle marginBounds, Rectangle pageBounds, PageSettings pageSettings, ref object state)
{
pageSettings.Landscape = false;
Image renderedImage = state as Image;
if (renderedImage == null)
{
// Store the whole rendered image and share it across multiple pages.
Size renderBounds = new Size(pageBounds.Width, 0);
string templateFile = GetTemplateFile();
if (templateFile == null)
{
return false;
}
renderedImage = TemplateRenderer.RenderOperation(GetSourceLocation(), _operation, templateFile, renderBounds);
state = renderedImage;
}
// Calculate the source rectangle (the portion of the rendered image) depending on which page we are in.
int pagesNeeded = (int)Math.Ceiling((double)renderedImage.Height / (double)pageBounds.Size.Height);
Rectangle destRect = pageBounds;
Rectangle srcRect = new Rectangle(0, pageBounds.Height * (pageIndex - 1), pageBounds.Width, pageBounds.Height);
graphics.DrawImage(renderedImage, destRect, srcRect, GraphicsUnit.Pixel);
return pageIndex < pagesNeeded;
}
示例7: loadReport
public void loadReport()
{
/*
// file ini disimpan di bin/debug
m_cryRpt.Load(Application.StartupPath + @".\REPORT\RESI.rpt");
// cara pemanggilan menggunakan data table yang sudah di proses dan di masukan ke object dt
m_cryRpt.Database.Tables[0].SetDataSource((DataTable)my_dt);
// data yang di panggil di ke data source otomatis tergambar ke dataset yang di buat dan berextensi xsd
crystalReportViewerRESI.ReportSource = m_cryRpt;
crystalReportViewerRESI.Refresh();
*/
reportViewerCETAKRESI.LocalReport.DataSources.Clear();
reportViewerCETAKRESI.LocalReport.ReportEmbeddedResource = "LOGISTICMANAGAMENTSYSTEM.REPORTS.EXPRESS.cetakRESI.rdlc";
Microsoft.Reporting.WinForms.ReportDataSource dataset = new Microsoft.Reporting.WinForms.ReportDataSource("dsRESI_V_TRANSAKSIEXPRESS", my_dt); // set the datasource
reportViewerCETAKRESI.LocalReport.DataSources.Add(dataset);
dataset.Value = my_dt;
System.Drawing.Printing.PageSettings pg = new PageSettings();
// Set margins
// Set paper size
pg.Margins.Top = 100;
pg.Margins.Bottom = 100;
pg.Margins.Left = 100;
pg.Margins.Right = 100;
pg.Landscape = false;
System.Drawing.Printing.PaperSize size = new PaperSize();
size.RawKind = (int)PaperKind.A4;
pg.PaperSize = size;
// reportViewerCETAKRESI.SetPageSettings(pg); ??
reportViewerCETAKRESI.LocalReport.Refresh();
reportViewerCETAKRESI.RefreshReport(); // refresh report
}
示例8: PrintForm
public PrintForm(PageSettings e)
{
InitializeComponent();
this.IsAccessible = false;
InitPrintForm();
_settings = e;
}
示例9: PrintDocument
// Constructor.
public PrintDocument()
{
this.documentName = "document";
this.originAtMargins = false;
this.printController = null;
this.printerSettings = new PrinterSettings();
this.defaultPageSettings = new PageSettings(printerSettings);
}
示例10: FromPrinter
public static Graphics FromPrinter (PageSettings page)
{
if (page == null) {
throw new ArgumentNullException("page");
}
Graphics test = page.PrinterSettings.CreateMeasurementGraphics();
return test;
}
示例11: GetPrintableArea
RectangleF GetPrintableArea(PageSettings pageSettings)
{
// Get the available page size on the page. Note the PrintableArea member of PageSettings does not automatically does the
// landscape into account.
RectangleF printableArea = pageSettings.PrintableArea;
if (pageSettings.Landscape)
printableArea = new RectangleF(printableArea.Top, printableArea.Left, printableArea.Height, printableArea.Width); // reverse rectangle for landscape
return printableArea;
}
示例12: PrintEngine
public PrintEngine()
{
_pageSettings = new PageSettings();
_pageSettings.Landscape = true;
_pageSettings.Margins.Top = 50;
_pageSettings.Margins.Bottom = 50;
_pageSettings.Margins.Left = 50;
_pageSettings.Margins.Right = 50;
_printerSettings = new PrinterSettings();
}
示例13: 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;
}
}
示例14: ReportPrintDocument
private ReportPrintDocument(Microsoft.Reporting.WinForms.Report report)
{
// Set the page settings to the default defined in the report
ReportPageSettings reportPageSettings = report.GetDefaultPageSettings();
// The page settings object will use the default printer unless
// PageSettings.PrinterSettings is changed. This assumes there
// is a default printer.
m_pageSettings = new PageSettings();
m_pageSettings.PaperSize = reportPageSettings.PaperSize;
m_pageSettings.Margins = reportPageSettings.Margins;
}
示例15: AutoPrintCls
//public AutoPrintCls(ServerReport serverReport)
// : this((Report)serverReport)
//{
// RenderAllServerReportPages(serverReport);
//}
//public AutoPrintCls(LocalReport localReport)
// : this((Report)localReport)
//{
// RenderAllLocalReportPages(localReport);
//}
private AutoPrintCls(LocalReport report)
{
// Set the page settings to the default defined in the report
ReportPageSettings reportPageSettings = report.GetDefaultPageSettings();
// The page settings object will use the default printer unless
// PageSettings.PrinterSettings is changed. This assumes there
// is a default printer.
m_pageSettings = new PageSettings();
m_pageSettings.PaperSize = reportPageSettings.PaperSize;
m_pageSettings.Margins = reportPageSettings.Margins;
}