コード例 #1
0
        public void print1(string printerName, string filePath)
        {
            // string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();
            // Create PdfViewer object
            PdfViewer viewer = new PdfViewer();

            // Open input PDF file
            viewer.BindPdf(filePath);
            // Set attributes for printing
            viewer.AutoResize      = true;    // Print the file with adjusted size
            viewer.AutoRotate      = true;    // Print the file with adjusted rotation
            viewer.PrintPageDialog = false;   // Do not produce the page number dialog when printing
            // Create objects for printer and page settings and PrintDocument
            System.Drawing.Printing.PrinterSettings ps     = new System.Drawing.Printing.PrinterSettings();
            System.Drawing.Printing.PageSettings    pgs    = new System.Drawing.Printing.PageSettings();
            System.Drawing.Printing.PrintDocument   prtdoc = new System.Drawing.Printing.PrintDocument();
            // Set printer name
            ps.PrinterName = prtdoc.PrinterSettings.PrinterName;
            // Set PageSize (if required)
            pgs.PaperSize = new System.Drawing.Printing.PaperSize("Custom", 280, 826);
            // Set PageMargins (if required)
            pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
            // ExStart:PrintDialog
            //System.Windows.Forms.PrintDialog printDialog = new System.Windows.Forms.PrintDialog();
            //if (printDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            //{
            // Document printing code goes here
            // Print document using printer and page settings
            viewer.PrintDocumentWithSettings(pgs, ps);
            //}
            // ExEnd:PrintDialog
            // Close the PDF file after priting
            viewer.Close();
        }
コード例 #2
0
        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;
        }
コード例 #3
0
    private void GenerateReport()
    {
        //dataTable

        ReportViewer1.Reset();

        DataTable        dt         = GetData();
        ReportDataSource dataSource = new ReportDataSource("DataSet1", dt);



        ReportViewer1.LocalReport.DataSources.Add(dataSource);
        ReportViewer1.LocalReport.ReportPath = "Laporan/InvRusak.rdlc";

        PageSettings pg = new System.Drawing.Printing.PageSettings();

        pg.Margins.Top    = 0;
        pg.Margins.Bottom = 0;
        pg.Margins.Left   = 0;
        pg.Margins.Right  = 0;

        PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();

        ps.PrinterName = "Microsoft XPS Document Writer";

        PaperSize size = new PaperSize();

        size.RawKind       = (int)PaperKind.A4;
        pg.PaperSize       = size;
        pg.PrinterSettings = ps;
        ReportViewer1.SetPageSettings(pg);

        ReportViewer1.LocalReport.Refresh();
    }
コード例 #4
0
ファイル: PrintPageEventArgs.cs プロジェクト: nlhepler/mono
		public PrintPageEventArgs(Graphics graphics, Rectangle marginBounds,
			Rectangle pageBounds, PageSettings pageSettings) {
			this.graphics = graphics;
			this.marginBounds = marginBounds;
			this.pageBounds = pageBounds;
			this.pageSettings = pageSettings;
		}
コード例 #5
0
        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
        }
コード例 #6
0
ファイル: PageSettingsTest.cs プロジェクト: nlhepler/mono
		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");
		}
コード例 #7
0
 public void SettingPagePotrait(System.Drawing.Printing.PageSettings pageSettings)
 {
     pageSettings.Margins.Top    = 0;
     pageSettings.Margins.Bottom = 0;
     pageSettings.Margins.Left   = 0;
     pageSettings.Margins.Right  = 0;
 }
コード例 #8
0
ファイル: Form1.cs プロジェクト: kivancozgur/CSharp-Example
        private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
        {
            Font baslik    = new System.Drawing.Font("Times", 12, FontStyle.Bold);
            Font altbaslik = new System.Drawing.Font("Arial", 11, FontStyle.Regular);

            System.Drawing.Printing.PageSettings p = printDocument1.DefaultPageSettings;
            int x = 95, y = 135, say = dataGridView1.Rows.Count;

            say = say - 2;
            e.Graphics.DrawLine(new Pen(Color.Black, 2), p.Margins.Left, 75, p.PaperSize.Width - p.Margins.Right, 75);
            e.Graphics.DrawString("Stok Adı", baslik, Brushes.Black, 100, 75);
            e.Graphics.DrawString("Stok Modeli", baslik, Brushes.Black, 225, 75);
            e.Graphics.DrawString("Seri No", baslik, Brushes.Black, 375, 75);
            e.Graphics.DrawString("Stok Adedi", baslik, Brushes.Black, 500, 75);
            e.Graphics.DrawString("Stok Tarihi", baslik, Brushes.Black, 6257, 75);
            e.Graphics.DrawLine(new Pen(Color.Black, 2), p.Margins.Left, 95, p.PaperSize.Width - p.Margins.Right, 95);
            while (i <= say)
            {
                x += 25;
                e.Graphics.DrawString(dataGridView1.Rows[i].Cells[1].Value.ToString(), altbaslik, Brushes.Black, 100, x);
                e.Graphics.DrawString(dataGridView1.Rows[i].Cells[2].Value.ToString(), altbaslik, Brushes.Black, 225, x);
                e.Graphics.DrawString(dataGridView1.Rows[i].Cells[3].Value.ToString(), altbaslik, Brushes.Black, 375, x);
                e.Graphics.DrawString(dataGridView1.Rows[i].Cells[4].Value.ToString(), altbaslik, Brushes.Black, 500, x);
                e.Graphics.DrawString(dataGridView1.Rows[i].Cells[5].Value.ToString(), altbaslik, Brushes.Black, 625, x);
                i++;
            }
        }
コード例 #9
0
ファイル: PrintForm.cs プロジェクト: JosonYang/aojreporter
 public PrintForm(PageSettings e)
 {
     InitializeComponent();
     this.IsAccessible = false;
     InitPrintForm();
     _settings = e;
 }
コード例 #10
0
ファイル: TLVectorControl.cs プロジェクト: EdgarEDT/myitoppsp
 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);
 }
コード例 #11
0
        public void Restore(System.Drawing.Printing.PageSettings a_settings)
        {
            Margins margins = new Margins(MarginLeft, MarginRight, MarginTop, MarginBottom);

            margins = PrinterUnitConvert.Convert(margins,
                                                 PrinterUnit.TenthsOfAMillimeter, PrinterUnit.HundredthsOfAMillimeter);
            a_settings.Margins = margins;

            a_settings.Landscape = Landscape;

            foreach (PaperSize paper_size in a_settings.PrinterSettings.PaperSizes)
            {
                if (paper_size.PaperName == PaperSizeName)
                {
                    a_settings.PaperSize = paper_size;
                }
            }

            foreach (PaperSource printer_source in a_settings.PrinterSettings.PaperSources)
            {
                if (printer_source.SourceName == PaperSourceName)
                {
                    a_settings.PaperSource = printer_source;
                }
            }
        }
コード例 #12
0
        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();
        }
コード例 #13
0
        //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;
            }
        }
コード例 #14
0
    private void GenerateReport()
    {
        //dataTable
        string idPengajuan = Request.QueryString["IdPengajuan"];

        ReportViewer1.Reset();
        ReportViewer1.LocalReport.ReportPath = "Laporan/PengajuanInvDetail.rdlc";

        PengajuanDomain peDomain = GeneratePengajuan(idPengajuan);

        ReportParameter[] parameters = new ReportParameter[5];
        parameters[0] = new ReportParameter("IDPengajuan", peDomain.IDPengajuan);
        parameters[1] = new ReportParameter("TglPengajuan", peDomain.Tgl);
        // parameters[2] = new ReportParameter("Judul", peDomain.Hal);
        parameters[2] = new ReportParameter("Judul", peDomain.Judul);
        parameters[3] = new ReportParameter("Keterangan", peDomain.Keterangan);

        if (peDomain.Prioritas.Equals("3"))
        {
            parameters[4] = new ReportParameter("Prioritas", "Normal");
        }
        else if (peDomain.Prioritas.Equals("2"))
        {
            parameters[4] = new ReportParameter("Prioritas", "Penting");
        }
        else if (peDomain.Prioritas.Equals("1"))
        {
            parameters[4] = new ReportParameter("Prioritas", "Urgen");
        }
        ReportViewer1.LocalReport.SetParameters(parameters);

        DataTable        dt         = GetData(peDomain.IDPengajuan);
        ReportDataSource dataSource = new ReportDataSource("DataSet1", dt);

        ReportViewer1.LocalReport.DataSources.Add(dataSource);
        ReportViewer1.ShowPrintButton = true;



        PageSettings pg = new System.Drawing.Printing.PageSettings();

        pg.Margins.Top    = 0;
        pg.Margins.Bottom = 0;
        pg.Margins.Left   = 0;
        pg.Margins.Right  = 0;

        PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();

        ps.PrinterName = "Microsoft XPS Document Writer";

        PaperSize size = new PaperSize();

        size.RawKind       = (int)PaperKind.A4;
        pg.PaperSize       = size;
        pg.PrinterSettings = ps;
        ReportViewer1.SetPageSettings(pg);

        ReportViewer1.LocalReport.Refresh();
    }
コード例 #15
0
	// Constructor.
	public PrintDocument()
			{
				this.documentName = "document";
				this.originAtMargins = false;
				this.printController = null;
				this.printerSettings = new PrinterSettings();
				this.defaultPageSettings = new PageSettings(printerSettings);
			}
コード例 #16
0
 public void SettingPageLandScape(System.Drawing.Printing.PageSettings pageSettings)
 {
     pageSettings.Margins.Top    = 1;
     pageSettings.Margins.Bottom = 1;
     pageSettings.Margins.Left   = 1;
     pageSettings.Margins.Right  = 1;
     pageSettings.Landscape      = true;
 }
コード例 #17
0
		public static Graphics FromPrinter (PageSettings page)
		{
			if (page == null) {
				throw new ArgumentNullException("page");
			}
			Graphics test = page.PrinterSettings.CreateMeasurementGraphics();
			return test;
		}
コード例 #18
0
 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;
 }
コード例 #19
0
ファイル: PrinterSettings.cs プロジェクト: nlhepler/mono
		private void ResetToDefaults ()
		{			
			printer_resolutions = null;
			paper_sizes = null;
			paper_sources = null;
			default_pagesettings = null;
			maximum_page = 9999; 	
			copies = 1;
			collate = true;
		}
コード例 #20
0
 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();
 }
コード例 #21
0
        private void frmStockMovInforme_Load(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            /*  strFechaDesde = fechaDesde.ToString("yyyy-MM-dd 00:00:00");
             * strFechaHasta = fechaHasta.ToString("yyyy-MM-dd 00:00:00");
             * formularioOrigen = "frmStockMovInforme";
             * accionProgress = "cargar";
             * progreso = new frmProgress(strFechaDesde, strFechaHasta, idLocal, tipo, opcMov, formularioOrigen, accionProgress);
             * progreso.ShowDialog();
             * dsStockMov = frmProgress.dsStockMovCons;
             * if (dsStockMov == null) return; // no hay conexion*/
            tblStockMovDetalle           = dsStockMov.Tables[1];
            tblStockMovDetalle.TableName = "StockMovDetalle";
            tblLocales            = BL.GetDataBLL.Locales();
            tblLocales.PrimaryKey = new DataColumn[] { tblLocales.Columns["IdLocalLOC"] };
            tblStockMovDetalle.Columns.Add("OrigenMSTK", typeof(string));
            tblStockMovDetalle.Columns.Add("DestinoMSTK", typeof(string));
            viewStockMov = new DataView(tblStockMovDetalle);
            int local;

            foreach (DataRowView fila in viewStockMov)
            {
                local = Convert.ToInt32(fila["OrigenMSTKD"].ToString());
                DataRow foundRow = tblLocales.Rows.Find(local);
                fila["OrigenMSTK"] = foundRow[1].ToString();
                local = Convert.ToInt32(fila["DestinoMSTKD"].ToString());
                DataRow foundRow2 = tblLocales.Rows.Find(local);
                fila["DestinoMSTK"] = foundRow2[1].ToString();
            }
            Cursor.Current = Cursors.Arrow;
            this.reportViewer1.ProcessingMode = ProcessingMode.Local;
            string   path = Application.StartupPath + @"\Informes\StockMov.rdlc";
            DataView view = new DataView(tblStockMovDetalle);

            if (opcOrden == "movimiento")
            {
                view.Sort = "FechaMSTK, ordenar";
            }
            else
            {
                view.Sort = "FechaMSTK, DescripcionART";
            }
            this.reportViewer1.LocalReport.ReportPath = path;


            reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", view));
            System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings();
            pg.Margins   = new System.Drawing.Printing.Margins(19, 19, 19, 19); //centesimas de pulgada
            pg.PaperSize = new PaperSize("A4", 827, 1169);                      // 8.27 in x 11.69 in   19.685in
            pg.Landscape = true;
            //      this.reportViewer1.LocalReport.SetParameters(parameters);
            reportViewer1.RefreshReport();
            reportViewer1.SetDisplayMode(DisplayMode.PrintLayout);
        }
コード例 #22
0
        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;
            }
        }
コード例 #23
0
        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;
        }
コード例 #24
0
ファイル: AutoPrintBase.cs プロジェクト: ranyaof/ongaz
        //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;
        }
コード例 #25
0
 public SeriesDataPrinter(SeriesData data)
 {
     this.data = data;
     this.document = new PrintDocument();
     this.document.DocumentName = data.SeriesName + "document";
     this.printFont = new Font("Arial", 10);
     this.printSettings = new PrinterSettings();
     this.pageSettings = new PageSettings();
     this.document.PrinterSettings = this.printSettings;
     this.document.DefaultPageSettings = this.pageSettings;
     this.document.PrintPage += new PrintPageEventHandler(document_PrintPage);
     this.document.BeginPrint += new PrintEventHandler(document_BeginPrint);
 }
コード例 #26
0
        private PrintTicket GetPrintTicket(PrintQueue printQueue, System.Drawing.Printing.PageSettings pageSettings)
        {
            PrintTicketConverter printTicketConverter = new PrintTicketConverter(printQueue.FullName, printQueue.ClientPrintSchemaVersion);
            IntPtr devmodeHandle = pageSettings.PrinterSettings.GetHdevmode(pageSettings);
            int    size          = (int)GlobalSize(devmodeHandle);
            IntPtr devmodePtr    = GlobalLock(devmodeHandle);

            byte[] devMode = new byte[size];
            Marshal.Copy(devmodePtr, devMode, 0, size);
            GlobalUnlock(devmodeHandle);
            GlobalFree(devmodeHandle);
            return(printTicketConverter.ConvertDevModeToPrintTicket(devMode));
        }
コード例 #27
0
        private ReportPrintDocument(Report report,bool isLanscape)
        {
            // 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;
            m_pageSettings.Landscape = isLanscape;
        }
コード例 #28
0
ファイル: PrintHelper.cs プロジェクト: EdgarEDT/myitoppsp
 public PrintHelper(ItopVectorControl tc, Itop.MapView.IMapViewObj map)
 {
     //int chose = Convert.ToInt32(ConfigurationSettings.AppSettings.Get("chose"));
     //if (chose == 1)
     //{ map = new Itop.MapView.MapViewObj(); }
     //else if (chose == 2)
     //{ map = new Itop.MapView.MapViewObj2(); }
     tlVectorControl1 = tc;
     mapview = map;
     pdoc = new PrintDocument();
     pdoc.PrintPage += new PrintPageEventHandler(pdoc_PrintPage);
     pageSetting = pdoc.PrinterSettings.DefaultPageSettings;
 }
コード例 #29
0
 public override void Reset()
 {
     this.allowMargins = true;
     this.allowOrientation = true;
     this.allowPaper = true;
     this.allowPrinter = true;
     this.MinMargins = null;
     this.pageSettings = null;
     this.printDocument = null;
     this.printerSettings = null;
     this.showHelp = false;
     this.showNetwork = true;
 }
コード例 #30
0
 public override void Reset()
 {
     this.allowMargins     = true;
     this.allowOrientation = true;
     this.allowPaper       = true;
     this.allowPrinter     = true;
     this.MinMargins       = null;
     this.pageSettings     = null;
     this.printDocument    = null;
     this.printerSettings  = null;
     this.showHelp         = false;
     this.showNetwork      = true;
 }
コード例 #31
0
        private void ShowReport(DataSet set1, MemoryStream ms_rdl)
        {
            this.reportViewer1.Reset();
            this.reportViewer1.LocalReport.LoadReportDefinition(ms_rdl);
            this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("MyData", set1.Tables[0]));
            this.reportViewer1.RefreshReport();

            System.Drawing.Printing.PageSettings configuracion = new System.Drawing.Printing.PageSettings();
            configuracion.Landscape = true;
            Margins margins = new Margins(20, 20, 50, 20);

            configuracion.Margins = margins;
            reportViewer1.SetPageSettings(configuracion);
        }
コード例 #32
0
        /// <summary>
        /// Class constructor
        /// </summary>
        /// <param name="paginator"></param>
        /// <param name="pageSettings"></param>
        /// <param name="printTicket"></param>
        /// <param name="headerFooterfontFamily"></param>
        public DocumentPaginatorWrapper(DocumentPaginator paginator, PageSettings pageSettings, PrintTicket printTicket, FontFamily headerFooterfontFamily)
        {
            m_Margins = ConvertMarginsToPx(pageSettings.Margins);

              if (pageSettings.Landscape)
            m_PageSize = new Size((int)printTicket.PageMediaSize.Height, (int)printTicket.PageMediaSize.Width);
              else
            m_PageSize = new Size((int)printTicket.PageMediaSize.Width, (int)printTicket.PageMediaSize.Height);

              m_Paginator = paginator;
              m_Paginator.PageSize = new Size(m_PageSize.Width - m_Margins.Left - m_Margins.Right, m_PageSize.Height - m_Margins.Top - m_Margins.Bottom);

              m_Typeface = new Typeface(headerFooterfontFamily, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
        }
コード例 #33
0
ファイル: TestForm.cs プロジェクト: StigmaKim/ChurchFinance
        public TestForm()
        {
            InitializeComponent();

            printDoc = new PrintDocument();
            pgSettings = new PageSettings();
            prtSetting = new PrinterSettings();

            neoTabWindow1.Renderer = AddInRendererManager.LoadRenderer("MarginBlueRendererVS2");
            
            neoTabPage1.Text = "수 입";
            neoTabPage1.BackColor = Color.White;
            neoTabPage1.Controls.Add(income);
        }
コード例 #34
0
        // 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;
            }
        }
コード例 #35
0
        private ReportPrintDocument(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.
            _mPageSettings = new PageSettings
            {
                Landscape = true,
                PaperSize = reportPageSettings.PaperSize,
                Margins = reportPageSettings.Margins
            };
        }
コード例 #36
0
 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);
     }
 }
コード例 #37
0
    private void GenerateReport()
    {
        //dataTable
        string idPengajuan = Request.QueryString["IdPembelian"];

        ReportViewer1.Reset();
        ReportViewer1.LocalReport.ReportPath = "Laporan/PembelianDetail.rdlc";

        PembelianDomain peDomain = GeneratePembelian(idPengajuan);

        ReportParameter[] parameters = new ReportParameter[6];
        parameters[0] = new ReportParameter("NoPembelian", peDomain.IDPembelian);
        parameters[1] = new ReportParameter("TglBeli", peDomain.Tgl);
        // parameters[2] = new ReportParameter("Judul", peDomain.Hal);
        parameters[2] = new ReportParameter("Keterangan", peDomain.Keterangan);
        parameters[3] = new ReportParameter("RefPengajuan", peDomain.RefPengajuan);
        parameters[4] = new ReportParameter("HargaTotal", peDomain.HargaTotal);
        parameters[5] = new ReportParameter("Status", peDomain.status);
        ReportViewer1.LocalReport.SetParameters(parameters);

        DataTable        dt         = GetData(peDomain.RefPengajuan);
        ReportDataSource dataSource = new ReportDataSource("DataSet1", dt);

        ReportViewer1.LocalReport.DataSources.Add(dataSource);
        ReportViewer1.ShowPrintButton = true;



        PageSettings pg = new System.Drawing.Printing.PageSettings();

        pg.Margins.Top    = 0;
        pg.Margins.Bottom = 0;
        pg.Margins.Left   = 0;
        pg.Margins.Right  = 0;

        PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();

        ps.PrinterName = "Microsoft XPS Document Writer";

        PaperSize size = new PaperSize();

        size.RawKind       = (int)PaperKind.A4;
        pg.PaperSize       = size;
        pg.PrinterSettings = ps;
        ReportViewer1.SetPageSettings(pg);

        ReportViewer1.LocalReport.Refresh();
    }
コード例 #38
0
ファイル: WaveManager.cs プロジェクト: banderson/Wave-Manager
        static WaveManager()
        {
            FileClosed += RemoveOpenFile;
            WindowSelected += SetActiveFile;
            AppSettingsChanged += SerializeSettings;
            CurrentWindowModified += MarkAsModified;

            _settings = new AppSettings();
            _settingsFile = Path.GetFullPath(".") + Path.DirectorySeparatorChar + "settings.config";
            PageSettings = new PageSettings();

            if (File.Exists(_settingsFile))
            {
                _settings = DeserializeSettings();
            }
        }
コード例 #39
0
        private void EtiquetasA4Rpt_Load(object sender, EventArgs e)
        {
            this.reportViewer1.ProcessingMode = ProcessingMode.Local;
            string path;

            path = Application.StartupPath + @"\Informes\EtiquetasA4.rdlc";
            this.reportViewer1.LocalReport.ReportPath = path;
            reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Dataset_informes", tblEtiquetas));
            System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings();
            pg.Margins   = new System.Drawing.Printing.Margins(0, 0, 0, 0); //centesimas de pulgada
            pg.PaperSize = new PaperSize("A4", 827, 1169);                  // 8.27 in x 11.69 in
            pg.PrinterResolution.Kind = System.Drawing.Printing.PrinterResolutionKind.High;
            this.reportViewer1.SetPageSettings(pg);
            this.reportViewer1.RefreshReport();
            this.reportViewer1.SetDisplayMode(DisplayMode.PrintLayout);
        }
コード例 #40
0
        public void Save(System.Drawing.Printing.PageSettings a_settings)
        {
            Margins margins = PrinterUnitConvert.Convert(a_settings.Margins,
                                                         PrinterUnit.ThousandthsOfAnInch, PrinterUnit.TenthsOfAMillimeter);

            MarginLeft   = margins.Left;
            MarginRight  = margins.Right;
            MarginTop    = margins.Top;
            MarginBottom = margins.Bottom;

            Landscape       = a_settings.Landscape;
            PaperSizeName   = a_settings.PaperSize.PaperName;
            PaperSourceName = a_settings.PaperSource.SourceName;

            Config.Instance.Save();
        }
コード例 #41
0
 public Reporte_PapeletaIngresadas(ScrollViewer scroll)
 {
     this.scrollContenedor = scroll;
     InitializeComponent();
     System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings();
     pg.Margins.Top    = 0;
     pg.Margins.Bottom = 0;
     pg.Margins.Left   = 0;
     pg.Margins.Right  = 0;
     System.Drawing.Printing.PaperSize size = new System.Drawing.Printing.PaperSize();
     size.RawKind = (int)PaperKind.B5;
     pg.PaperSize = size;
     DemorReport.SetPageSettings(pg);
     this.DemorReport.RefreshReport();
     DemorReport.Reset();
 }
コード例 #42
0
ファイル: Form1.cs プロジェクト: Vlanta/CspBase
        /// <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);
            }
        }
コード例 #43
0
        //2�����Print��ӡ����
        public void StartPrint(Stream streamToPrint, string streamType)
        {
            //����ֵ��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; //��ӡ������
            pdDocument.DocumentName = Filename; //��ӡ���ļ���
            Psdl.Document = pdDocument;
            PrintPreview.Document = pdDocument;
            pt.Document = pdDocument;
            Psdl.PageSettings = pdDocument.DefaultPageSettings;
            try
            {
                //ҳ�����öԻ���
                if (Psdl.ShowDialog() == DialogResult.OK)
                {
                    ps = Psdl.PageSettings;
                    pdDocument.DefaultPageSettings = Psdl.PageSettings;
                }
                //ѡ���ӡ���Ի���
                if (pt.ShowDialog() == DialogResult.OK)
                {
                    pdDocument.PrinterSettings.Copies = pt.PrinterSettings.Copies;
                    pdDocument.Print();
                }
                //��ӡԤ���Ի���
                if (PrintPreview.ShowDialog() == DialogResult.OK)
                {
                    //���ô�ӡ
                    pdDocument.Print();
                }

                //PrintDocument�����Print()������PrintController����ִ��PrintPage�¼���
            }
            catch (InvalidPrinterException ex)
            {
                MessageBox.Show(ex.Message, "Simple Editor", MessageBoxButtons.OK, MessageBoxIcon.Error);
                throw;
            }
        }
コード例 #44
0
ファイル: ImpressaoBE.aspx.cs プロジェクト: henriqlustosa/ps
    private void Imprimir(Microsoft.Reporting.WebForms.LocalReport relatorio)
    {
        using (var pd = new System.Drawing.Printing.PrintDocument())
        {
            //configurar impressora
            pd.PrinterSettings.PrinterName = "Microsoft Print to PDF";
            var pageSettings          = new System.Drawing.Printing.PageSettings();
            var pageSettingsRelatorio = relatorio.GetDefaultPageSettings();
            pageSettings.PaperSize = pageSettingsRelatorio.PaperSize;
            pageSettings.Margins   = pageSettingsRelatorio.Margins;
            pd.DefaultPageSettings = pageSettings;

            pd.PrintPage += Pd_PrintPage;
            _streamAtual  = 0;
            pd.Print();
        }
    }
コード例 #45
0
 private void btnPrintSet_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.pageSet == null)
         {
             this.pageSet = new PageSettings();
             pageSetupD.PageSettings = this.pageSet; //必须设置pageSet
             // pageSetupDialog1.Document = printDocument1;
             pageSetupD.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #46
0
    private void GenerateReport()
    {
        //dataTable

        ReportViewer1.Reset();
        ReportViewer1.LocalReport.ReportPath = "Laporan/PengajuanInvDetail.rdlc";

        PengajuanDomain peDomain = GeneratePengajuan(TbIDNoPengajuan.Text);

        ReportParameter[] parameters = new ReportParameter[6];
        parameters[0] = new ReportParameter("No", peDomain.No);
        parameters[1] = new ReportParameter("TglPengajuan", peDomain.TglPengajuan);
        parameters[2] = new ReportParameter("Hal", peDomain.Hal);
        parameters[3] = new ReportParameter("Keterangan", peDomain.Keterangan);
        parameters[4] = new ReportParameter("Prioritas", peDomain.Prioritas);
        parameters[5] = new ReportParameter("Pengaju", peDomain.Pengaju);
        ReportViewer1.LocalReport.SetParameters(parameters);

        DataTable        dt         = GetData(peDomain.id);
        ReportDataSource dataSource = new ReportDataSource("DS_V_Pengajuan_report_detail", dt);

        ReportViewer1.LocalReport.DataSources.Add(dataSource);
        ReportViewer1.ShowPrintButton = true;



        PageSettings pg = new System.Drawing.Printing.PageSettings();

        pg.Margins.Top    = 0;
        pg.Margins.Bottom = 0;
        pg.Margins.Left   = 0;
        pg.Margins.Right  = 0;

        PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();

        ps.PrinterName = "Microsoft XPS Document Writer";

        PaperSize size = new PaperSize();

        size.RawKind       = (int)PaperKind.A4;
        pg.PaperSize       = size;
        pg.PrinterSettings = ps;
        ReportViewer1.SetPageSettings(pg);

        ReportViewer1.LocalReport.Refresh();
    }
コード例 #47
0
    private void GenerateReport()
    {
        //dataTable

        ReportViewer1.Reset();
        ReportViewer1.LocalReport.ReportPath = "Laporan/ServiceKeluarDetail.rdlc";

        ServiceKeluar peDomain = GenerateService(TbIDNoPengajuan.Text);

        ReportParameter[] parameters = new ReportParameter[6];
        parameters[0] = new ReportParameter("IDService", peDomain.id);
        parameters[1] = new ReportParameter("JudulService", peDomain.Judul);
        parameters[2] = new ReportParameter("Status", peDomain.Status);
        parameters[3] = new ReportParameter("TglService", peDomain.TglService);
        parameters[4] = new ReportParameter("RefService", peDomain.RefService);
        parameters[5] = new ReportParameter("Keterangan", peDomain.Keterangan);
        ReportViewer1.LocalReport.SetParameters(parameters);

        DataTable        dt         = GetData(peDomain.RefService);
        ReportDataSource dataSource = new ReportDataSource("DataSet1", dt);

        ReportViewer1.LocalReport.DataSources.Add(dataSource);
        ReportViewer1.ShowPrintButton = true;



        PageSettings pg = new System.Drawing.Printing.PageSettings();

        pg.Margins.Top    = 0;
        pg.Margins.Bottom = 0;
        pg.Margins.Left   = 0;
        pg.Margins.Right  = 0;

        PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();

        ps.PrinterName = "Microsoft XPS Document Writer";

        PaperSize size = new PaperSize();

        size.RawKind       = (int)PaperKind.A4;
        pg.PaperSize       = size;
        pg.PrinterSettings = ps;
        ReportViewer1.SetPageSettings(pg);

        ReportViewer1.LocalReport.Refresh();
    }
コード例 #48
0
        public Form5(int Terminal)
        {
            _Terminal = Terminal;
            bw.WorkerReportsProgress      = true;
            bw.WorkerSupportsCancellation = true;
            bw.DoWork += new DoWorkEventHandler(bw_DoWork);
            InitializeComponent();
            System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings();
            pg.Margins.Top    = 0;
            pg.Margins.Bottom = 0;
            pg.Margins.Left   = 0;
            pg.Margins.Right  = 0;

            pg.Landscape = true;

            reportViewer1.SetPageSettings(pg);
            // reportViewer1.Report.PageSettings.Landscape = true;
        }
コード例 #49
0
 public MtrReport()
 {
     InitializeComponent();
     this.WindowState = FormWindowState.Maximized;
     System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings();
     pg.Margins.Top    = 5;
     pg.Margins.Bottom = 5;
     pg.Margins.Left   = 20;
     pg.Margins.Right  = 5;
     System.Drawing.Printing.PaperSize size = new PaperSize();
     size.RawKind = (int)PaperKind.A4;
     pg.PaperSize = size;
     pg.Landscape = true;
     reportViewer1.SetPageSettings(pg);
     this.reportViewer1.RefreshReport();
     reportViewer1.ShowExportButton = false;
     reportViewer1.ShowFindControls = false;
 }
コード例 #50
0
    // ------------------------------------------------------------------
    /// <summary>
    /// Constructor.
    /// </summary>
    /// <param name="pageSettings">PageSettings: The page setup for the
    /// diagram.</param>
    /// <param name="diagram">IDiagramControl: The diagram to print.
    /// </param>
    /// <param name="printPreviewOnly">bool: Specifies if only a print
    /// preview is to be performed.  If true, then a PrintPreviewDialog
    /// is shown.  If false, then a PrintDialog is shown and the diagram
    /// is printed if the user elects to.</param>
    // ------------------------------------------------------------------
    public DiagramPrinter(
        PageSettings pageSettings,
        IDiagramControl diagram,
        bool printPreviewOnly) {
      this.myDiagram = diagram;
      this.numberOfPages = diagram.Controller.Model.Pages.Count;
      this.myPageSettings = pageSettings;
      this.myDocument = new PrintDocument();
      this.myDocument.DefaultPageSettings = this.myPageSettings;
      this.myDocument.PrintPage +=
          new PrintPageEventHandler(PrintPage);

      if (printPreviewOnly) {
        this.PrintPreview();
      } else {
        this.Print();
      }
    }
コード例 #51
0
        private void RMainTankLogSheet_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'maintenanceDataSet1.m_FuelMainLogSheetReport' table. You can move, or remove it, as needed.
            //this.m_FuelMainLogSheetReportTableAdapter.Fill(this.maintenanceDataSet1.m_FuelMainLogSheetReport);
            System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings();

            ReportParameter[] rptParams = new ReportParameter[(8)];
            rptParams[0] = new ReportParameter("TankName", TankName);
            rptParams[1] = new ReportParameter("TankRefill", TankRefill);
            rptParams[2] = new ReportParameter("FuelType", FuelType);
            rptParams[3] = new ReportParameter("PreviousRemaining", PreviousRemaining);
            rptParams[4] = new ReportParameter("DateLog", DateLog);
            rptParams[5] = new ReportParameter("TankAvailability", TankAvailability);
            rptParams[6] = new ReportParameter("FuelPullOut", FuelPullOut);
            rptParams[7] = new ReportParameter("TankRemaining", TankRemaining);

            reportViewer1.LocalReport.SetParameters(rptParams);

            var setup = reportViewer1.GetPageSettings();

            //setup.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
            pg.Margins.Top    = 0; //Convert.ToInt32(0.2);
            pg.Margins.Bottom = 0;
            pg.Margins.Left   = 0;
            pg.Margins.Right  = 0;

            pg.Landscape = true;


            reportViewer1.SetPageSettings(pg);

            reportViewer1.SetDisplayMode(DisplayMode.PrintLayout);

            //this.reportviewer1.loca= datagridl;
            this.m_FuelMainLogSheetReportBindingSource.DataSource = DataGridl;
            this.reportViewer1.RefreshReport();


            ////this.reportViewer1.loca= DataGridl;
            ////this.m_FuelMainLogSheetReportBindingSource.DataSource = DataGridl;
            //ReportDataSource rds = new ReportDataSource("extraMove", DataGridl);
            //this.reportViewer1.LocalReport.DataSources.Add(rds);
            //this.reportViewer1.RefreshReport();
        }
コード例 #52
0
ファイル: printt.cs プロジェクト: kanokpolkulsri/tmdseo4
 private void printt_Load(object sender, EventArgs e)
 {
     // TODO: This line of code loads data into the 'databaseDataSet.tb_Report' table. You can move, or remove it, as needed.
     this.tb_ReportTableAdapter.Fill(this.databaseDataSet.tb_Report);
     System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings();
     pg.Margins.Top    = 5;
     pg.Margins.Bottom = 5;
     pg.Margins.Left   = 5;
     pg.Margins.Right  = 5;
     System.Drawing.Printing.PaperSize size = new PaperSize();
     size.RawKind = (int)PaperKind.A4;
     pg.PaperSize = size;
     reportViewer1.SetPageSettings(pg);
     oda = new OleDbDataAdapter("SELECT * FROM tb_Report", conn);
     dt  = new DataTable();
     oda.Fill(dt);
     tb_ReportBindingSource.DataSource = dt;
     reportViewer1.ShowExportButton    = false;
     reportViewer1.ShowFindControls    = false;
 }
コード例 #53
0
ファイル: Report.cs プロジェクト: darkholds/mcs_pams
        public void RunReport()
        {
            RViewer.LocalReport.Refresh();
            RViewer.RefreshReport();

            System.Drawing.Printing.PageSettings ps = new System.Drawing.Printing.PageSettings();
            ps.Landscape                       = false;
            ps.PaperSize.RawKind               = (int)PaperKind.Custom;
            ps.PaperSize                       = new PaperSize("User-Defined", 420, 550);
            ps.Margins.Top                     = 2;
            ps.Margins.Bottom                  = 2;
            ps.Margins.Left                    = 1;
            ps.Margins.Right                   = 1;
            RViewer.ShowBackButton             = false;
            RViewer.ShowFindControls           = false;
            RViewer.ShowPageNavigationControls = false;
            RViewer.ShowRefreshButton          = false;
            RViewer.ShowStopButton             = false;
            RViewer.SetPageSettings(ps);
        }
コード例 #54
0
        private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
        {
            Font baslik    = new System.Drawing.Font("Arial", 13, FontStyle.Bold);
            Font altbaslik = new System.Drawing.Font("Arial", 12, FontStyle.Regular);

            System.Drawing.Printing.PageSettings p = printDocument1.DefaultPageSettings;
            int x = 135, y = 135, say = dataGridView1.Rows.Count - 1;

            e.Graphics.DrawLine(new Pen(Color.Black, 2), p.Margins.Left, 125, p.PaperSize.Width - p.Margins.Right, 125);
            e.Graphics.DrawString("Ad", baslik, Brushes.Black, 130, 130);
            e.Graphics.DrawString("Soyad", baslik, Brushes.Black, 300, 130);
            e.Graphics.DrawString("Telefon", baslik, Brushes.Black, 460, 130);

            e.Graphics.DrawLine(new Pen(Color.Black, 2), p.Margins.Left, 153, p.PaperSize.Width - p.Margins.Right, 153);

            for (i = 0; i < say; i++)
            {
                x += 25;
                e.Graphics.DrawString(i.ToString() + " " + dataGridView1.Rows[i].Cells[1].Value.ToString(), altbaslik, Brushes.Black, 130, x);
                e.Graphics.DrawString(dataGridView1.Rows[i].Cells[2].Value.ToString(), altbaslik, Brushes.Black, 300, x);
                e.Graphics.DrawString(dataGridView1.Rows[i].Cells[3].Value.ToString(), altbaslik, Brushes.Black, 460, x);
                e.Graphics.DrawLine(new Pen(Color.Black, 1), p.Margins.Left, x + 20, p.PaperSize.Width - p.Margins.Right, x + 20);


                if ((x + y + 20) > (p.PaperSize.Height + 80 - p.Margins.Bottom + 80))
                {
                    e.HasMorePages = true;
                    break;
                }
            }
            e.Graphics.DrawLine(new Pen(Color.Black, 1), p.Margins.Left, 125, p.Margins.Left, x + 20);
            e.Graphics.DrawLine(new Pen(Color.Black, 1), p.Margins.Left + 175, 125, p.Margins.Left + 175, x + 20);
            e.Graphics.DrawLine(new Pen(Color.Black, 1), p.Margins.Left + 335, 125, p.Margins.Left + 335, x + 20);
            e.Graphics.DrawLine(new Pen(Color.Black, 1), p.Margins.Left + 625, 125, p.Margins.Left + 625, x + 20);

            if (i >= say)
            {
                e.HasMorePages = false;
                i = 0;
            }
        }
コード例 #55
0
    private void GenerateReport()
    {
        //dataTable

        ReportViewer1.Reset();

        DataTable        dt         = GetData();
        ReportDataSource dataSource = new ReportDataSource("DSet_V_Pengajuan_Report", dt);



        ReportViewer1.LocalReport.DataSources.Add(dataSource);
        ReportViewer1.LocalReport.ReportPath = "Laporan/PengajuanInv.rdlc";
        ReportViewer1.ShowPrintButton        = true;

        ReportParameter[] parameters = new ReportParameter[2];
        parameters[0] = new ReportParameter("TglDari", TbTanggalDari.Text);
        parameters[1] = new ReportParameter("TglKe", TbTanggalKe.Text);
        ReportViewer1.LocalReport.SetParameters(parameters);


        PageSettings pg = new System.Drawing.Printing.PageSettings();

        pg.Margins.Top    = 0;
        pg.Margins.Bottom = 0;
        pg.Margins.Left   = 0;
        pg.Margins.Right  = 0;

        PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();

        ps.PrinterName = "Microsoft XPS Document Writer";

        PaperSize size = new PaperSize();

        size.RawKind       = (int)PaperKind.A4;
        pg.PaperSize       = size;
        pg.PrinterSettings = ps;
        ReportViewer1.SetPageSettings(pg);

        ReportViewer1.LocalReport.Refresh();
    }
コード例 #56
0
 /// <summary>
 /// 已重载:查询页面设置
 /// </summary>
 /// <param name="e">事件参数</param>
 protected override void OnQueryPageSettings(System.Drawing.Printing.QueryPageSettingsEventArgs e)
 {
     if (myDocument != null)
     {
         System.Drawing.Printing.PageSettings ps = myDocument.Pages.PageSettings.StdPageSettings;
         foreach (System.Drawing.Printing.PaperSize mySize in this.PrinterSettings.PaperSizes)
         {
             if (ps.PaperSize.PaperName == mySize.PaperName)
             {
                 ps.PaperSize = mySize;
                 break;
             }
         }
         e.PageSettings = ps;
         if (myDocument.Pages.PrinterSettings != null)
         {
             this.PrinterSettings = myDocument.Pages.PrinterSettings;
         }
     }
     base.OnQueryPageSettings(e);
 }
コード例 #57
0
 public FormAccountReport(bool Mode)
 {
     InitializeComponent();
     if (Mode == true)
     {
         System.Drawing.Printing.PageSettings pageSettings = new System.Drawing.Printing.PageSettings();
         SettingPagePotrait(pageSettings);
         reportAccountDetail.SetPageSettings(pageSettings);
         DataTable dataTable = sqLGetData.AccountSearch(FormAccount.Forms.textBoxAccountID.Text);
         reportAccountDetail.LocalReport.DataSources.Clear();
         reportAccountDetail.LocalReport.DataSources.Add(new ReportDataSource("ReportDataSet", dataTable));
         reportAccountDetail.LocalReport.ReportEmbeddedResource = "ArlixAJP.Account.ReportAccountDetail.rdlc";
         ReportParameter[] reportParameters = new ReportParameter[4];
         reportParameters[0] = new ReportParameter("ReParCompName", Properties.Settings.Default.CompName, true);
         reportParameters[1] = new ReportParameter("ReParCompAddress", Properties.Settings.Default.CompAddress, true);
         reportParameters[2] = new ReportParameter("ReParCompPhone", Properties.Settings.Default.CompPhone, true);
         reportParameters[3] = new ReportParameter("ReParCompEmail", Properties.Settings.Default.CompEmail, true);
         reportAccountDetail.LocalReport.SetParameters(reportParameters);
         reportAccountDetail.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
         reportAccountDetail.RefreshReport();
     }
     else
     {
         System.Drawing.Printing.PageSettings pageSettings = new System.Drawing.Printing.PageSettings();
         SettingPageLandScape(pageSettings);
         reportAccountDetail.SetPageSettings(pageSettings);
         DataTable dataTable = sqLGetData.AccountList();
         reportAccountDetail.LocalReport.DataSources.Clear();
         reportAccountDetail.LocalReport.DataSources.Add(new ReportDataSource("ReportDataSet", dataTable));
         reportAccountDetail.LocalReport.ReportEmbeddedResource = "ArlixAJP.Account.ReportAccount.rdlc";
         ReportParameter[] reportParameters = new ReportParameter[4];
         reportParameters[0] = new ReportParameter("ReParCompName", Properties.Settings.Default.CompName, true);
         reportParameters[1] = new ReportParameter("ReParCompAddress", Properties.Settings.Default.CompAddress, true);
         reportParameters[2] = new ReportParameter("ReParCompPhone", Properties.Settings.Default.CompPhone, true);
         reportParameters[3] = new ReportParameter("ReParCompEmail", Properties.Settings.Default.CompEmail, true);
         reportAccountDetail.LocalReport.SetParameters(reportParameters);
         reportAccountDetail.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
         reportAccountDetail.RefreshReport();
     }
 }
コード例 #58
0
    private void GenerateReport()
    {
        string id = Request.QueryString["IdPenugasan"];

        //dataTable

        ReportViewer1.Reset();

        DataTable        dt          = GetData(id);
        DataTable        dt2         = GetDetail(id);
        DataTable        dt3         = GetDetailLain(id);
        ReportDataSource dataSource  = new ReportDataSource("DSPenugasan", dt);
        ReportDataSource dataSource2 = new ReportDataSource("DSPerbaikanDetail", dt2);
        ReportDataSource dataSource3 = new ReportDataSource("DSPenugasanLain", dt3);

        ReportViewer1.LocalReport.DataSources.Add(dataSource);
        ReportViewer1.LocalReport.DataSources.Add(dataSource2);
        ReportViewer1.LocalReport.DataSources.Add(dataSource3);
        ReportViewer1.LocalReport.ReportPath = "Laporan/PerbaikanBarang.rdlc";

        PageSettings pg = new System.Drawing.Printing.PageSettings();

        pg.Margins.Top    = 0;
        pg.Margins.Bottom = 0;
        pg.Margins.Left   = 0;
        pg.Margins.Right  = 0;

        PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();

        ps.PrinterName = "Microsoft XPS Document Writer";

        PaperSize size = new PaperSize();

        size.RawKind       = (int)PaperKind.A4;
        pg.PaperSize       = size;
        pg.PrinterSettings = ps;
        ReportViewer1.SetPageSettings(pg);

        ReportViewer1.LocalReport.Refresh();
    }
コード例 #59
0
ファイル: Form1.cs プロジェクト: pulmuone/FCL
        private void btnPrint_Click(object sender, EventArgs e)
        {
            CartonDataSet cartonDataSet = new CartonDataSet();
            DataTable     dt            = new DataTable();
            DataRow       dr;
            string        mcid = string.Empty;

            BarcodeLibSingleton.Instance.Barcode.IncludeLabel = false;
            BarcodeLibSingleton.Instance.Barcode.ImageFormat  = System.Drawing.Imaging.ImageFormat.Bmp;

            printerSettings.PrinterName = PrinterSingleton.Instance.PrinterName;

            System.Drawing.Printing.PageSettings pageSettings = new System.Drawing.Printing.PageSettings(printerSettings);
            //pageSettings.Landscape = true; //작동 안함...차이 없음.....

            PrintLayout.FitHorizontalPages = true;
            PrintLayout.Scaling            = PrintLayoutSettings.PrintScaling.DoNotScale;
            PrintLayout.Centered           = true;


            foreach (DataGridViewRow Rows in this.dataGridView1.Rows)
            {
                if (Rows.Cells["Print"].Value != null)
                {
                    if (Rows.Cells["Print"].Value.ToString() == "True")
                    {
                        if (Rows.Cells["ProdCode"].Value != null)
                        {
                            dr = cartonDataSet.Tables[0].NewRow();

                            dr["ProdName"]        = string.IsNullOrEmpty(Rows.Cells["ProdName"].Value.ToString()) ? string.Empty : Rows.Cells["ProdName"].Value.ToString().Trim();
                            dr["SubCode"]         = string.IsNullOrEmpty(Rows.Cells["SubCode"].Value.ToString()) ? string.Empty : Rows.Cells["SubCode"].Value.ToString().Trim();
                            dr["ProdColor"]       = string.IsNullOrEmpty(Rows.Cells["ProdColor"].Value.ToString()) ? string.Empty : Rows.Cells["ProdColor"].Value.ToString().Trim();
                            dr["Price"]           = string.IsNullOrEmpty(Rows.Cells["Price"].Value.ToString()) ? string.Empty : Rows.Cells["Price"].Value.ToString().Trim();
                            dr["Price2"]          = string.IsNullOrEmpty(Rows.Cells["Price2"].Value.ToString()) ? string.Empty : Rows.Cells["Price2"].Value.ToString().Trim();
                            dr["ProdCode"]        = string.IsNullOrEmpty(Rows.Cells["ProdCode"].Value.ToString()) ? string.Empty : Rows.Cells["ProdCode"].Value.ToString().Trim();
                            dr["SizeType"]        = string.IsNullOrEmpty(Rows.Cells["SizeType"].Value.ToString()) ? string.Empty : Rows.Cells["SizeType"].Value.ToString().Trim();
                            dr["CountryOfOrigin"] = string.IsNullOrEmpty(Rows.Cells["CountryOfOrigin"].Value.ToString()) ? string.Empty : Rows.Cells["CountryOfOrigin"].Value.ToString().Trim();

                            mcid = string.IsNullOrEmpty(Rows.Cells["ProdCode"].Value.ToString()) ? string.Empty : Rows.Cells["ProdCode"].Value.ToString().Trim();

                            if (string.IsNullOrEmpty(mcid))
                            {
                                dr["ProdCodeBarCode"] = null;
                            }
                            else
                            {
                                BarcodeLibSingleton.Instance.Barcode.Encode(BarcodeLib.TYPE.CODE128, mcid, 800, 100);
                                dr["ProdCodeBarCode"] = string.IsNullOrEmpty(mcid) ? null : BarcodeLibSingleton.Instance.Barcode.Encoded_Image_Bytes;
                            }

                            cartonDataSet.Tables[0].Rows.Add(dr);
                        }
                    }
                }
            }

            PrintOptions printOptions = this._myReport.PrintOptions;

            printOptions.DissociatePageSizeAndPrinterPaperSize = false;

            switch (comboBox1.SelectedIndex)
            {
            case 0:
                printOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.DefaultPaperOrientation;
                break;

            case 1:
                printOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Portrait;
                break;

            case 2:
                printOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
                break;
            }

            //printOptions.PaperSize = CrystalDecisions.Shared.PaperSize.DefaultPaperSize;

            _myReport.SetDataSource(cartonDataSet);
            this._myReport.PrintToPrinter(printerSettings, pageSettings, false, PrintLayout);
            //this._myReport.PrintToPrinter(1, false, 0, 0);
        }
コード例 #60
0
        private static void UpdateSettings(System.Windows.Forms.NativeMethods.PAGESETUPDLG data, System.Drawing.Printing.PageSettings pageSettings, System.Drawing.Printing.PrinterSettings printerSettings)
        {
            System.Windows.Forms.IntSecurity.AllPrintingAndUnmanagedCode.Assert();
            try
            {
                pageSettings.SetHdevmode(data.hDevMode);
                if (printerSettings != null)
                {
                    printerSettings.SetHdevmode(data.hDevMode);
                    printerSettings.SetHdevnames(data.hDevNames);
                }
            }
            finally
            {
                CodeAccessPermission.RevertAssert();
            }
            Margins margins = new Margins {
                Left   = data.marginLeft,
                Top    = data.marginTop,
                Right  = data.marginRight,
                Bottom = data.marginBottom
            };
            PrinterUnit fromUnit = ((data.Flags & 8) != 0) ? PrinterUnit.HundredthsOfAMillimeter : PrinterUnit.ThousandthsOfAnInch;

            pageSettings.Margins = PrinterUnitConvert.Convert(margins, fromUnit, PrinterUnit.Display);
        }