Exemple #1
0
        private void BtnStampaj_Click(object sender, EventArgs e)
        {
            TabelaStampaj();
            DGVPrinter stampac = new DGVPrinter();

            stampac.PageSettings.Landscape = true;
            stampac.Title               = "Izvoz računa";
            stampac.TitleSpacing        = 5;
            stampac.SubTitle            = dateTimePickerOD.Value.ToShortDateString() + " - " + dateTimePickerDO.Value.ToShortDateString();
            stampac.SubTitleSpacing     = 15;
            stampac.SubTitleFormatFlags = StringFormatFlags.LineLimit | StringFormatFlags.NoClip;
            stampac.PageNumbers         = true;
            stampac.PageNumberInHeader  = false;
            stampac.PorportionalColumns = true;
            stampac.HeaderCellAlignment = StringAlignment.Center;
            stampac.Footer              = "Vector-IT";
            stampac.FooterSpacing       = 15;

            stampac.HideColumns.Add("Export");
            stampac.HideColumns.Add("Datum dok.");
            stampac.PageText = "Strana ";

            stampac.PrintPreviewNoDisplay(dataGridView);
            //stampac.PrintPreviewDataGridView(dataGridView);
            //stampac.PrintDataGridView(dataGridView);
            TabelaStampajReset();
        }
Exemple #2
0
        internal static void PrintNow(DataGridView p_2, string title, string foter, bool casherprinter)
        {
            try
            {
                //data grid font
                DataGridViewCellStyle rd = new DataGridViewCellStyle(p_2.RowsDefaultCellStyle);
                rd.Font = FontPrint;
                Font oldfont = p_2.RowsDefaultCellStyle.Font;
                p_2.RowsDefaultCellStyle = rd;
                int oldwidth = p_2.Width;
                DataGridGVeiwPrinter.DGVPrinter Pr = new DGVPrinter();
                Pr.Footer              = foter + Environment.NewLine + "الليث للمحاسبة";
                Pr.CellAlignment       = System.Drawing.StringAlignment.Center;
                Pr.EnableLogging       = false;
                Pr.FooterBorder        = new System.Drawing.Pen(System.Drawing.Brushes.Black, 1);
                Pr.FooterFont          = Pr.TitleFont = Globals.FontPrintTitle;
                Pr.HeaderCellAlignment = System.Drawing.StringAlignment.Center;
                Pr.ShowTotalPageNumber = false; Pr.PageNumbers = false;
                Pr.TableAlignment      = DGVPrinter.Alignment.Center;
                Pr.Title          = Globals.CompanyName + Environment.NewLine + title + " " + MyDateTime.Now.ToString();
                Pr.TitleAlignment = System.Drawing.StringAlignment.Center;
                if (casherprinter)
                {
                    Pr.PrinterName = Globals.CasherPrinter;
                    try { p_2.Columns["ArabicUnit"].Visible = false; }
                    catch { }
                    string[] marg = Globals.CasherPrinterMarGin.Split(',');
                    Pr.PrintMargins.Left   = int.Parse(marg[0]);
                    Pr.PrintMargins.Right  = int.Parse(marg[1]);
                    Pr.PrintMargins.Top    = int.Parse(marg[2]);
                    Pr.PrintMargins.Bottom = int.Parse(marg[3]);

                    PrepeareStyleo(p_2, int.Parse(CasherPrinterWidth));
                    Pr.PrintDataGridView(p_2, false);
                    try { p_2.Columns["ArabicUnit"].Visible = true; }
                    catch { }
                }
                else
                {
                    if (Pr.DisplayPrintDialog() == DialogResult.OK)
                    {
                        PrepeareStyleo(p_2, Pr.PrintSettings.DefaultPageSettings.PaperSize.Width);
                        Pr.PrintPreviewNoDisplay(p_2);
                    }
                }

                //data grid font
                rd      = new DataGridViewCellStyle(p_2.RowsDefaultCellStyle);
                rd.Font = oldfont;
                p_2.RowsDefaultCellStyle = rd;
                PrepeareStyleo(p_2, oldwidth);
            }
            catch  { MessageBox.Show("عذرا يوجد خطأ في في محاولة ضبط حجم الطباعة " + "\n" + "تأكد من تعريف جهاز الطابعة"); }
        }
Exemple #3
0
        private void Print_Click(object sender, EventArgs e)
        {
            DGVPrinter printer = new DGVPrinter();

            printer.Title               = "مرتبات";
            printer.PageNumbers         = true;
            printer.PageNumberInHeader  = false;
            printer.PorportionalColumns = true;
            printer.HeaderCellAlignment = StringAlignment.Near;
            printer.printDocument.DefaultPageSettings.Landscape = true;
            Margins margins = new Margins(0, 0, 0, 0);

            printer.printDocument.DefaultPageSettings.Margins = margins;
            printer.PrintPreviewNoDisplay(salary_prepare);
        }
Exemple #4
0
        private void btnDGVpreivew_Click(object sender, EventArgs e)
        {
            DGVPrinter printer = new DGVPrinter();

            printer.Title               = "DataGridView Report";
            printer.SubTitle            = "An Easy to Use DataGridView Printing Object";
            printer.SubTitleFormatFlags = StringFormatFlags.LineLimit |
                                          StringFormatFlags.NoClip;
            printer.PageNumbers         = true;
            printer.PageNumberInHeader  = false;
            printer.ColumnWidth         = DGVPrinter.ColumnWidthSetting.Porportional;
            printer.HeaderCellAlignment = StringAlignment.Near;
            printer.Footer        = "Your Company Name Here";
            printer.FooterSpacing = 15;
            //printer.PrintDataGridView(GVHerb2);
            printer.PrintPreviewNoDisplay(GVHerb2);
        }
Exemple #5
0
        private void Print_Click(object sender, EventArgs e)
        {
            DGVPrinter printer = new DGVPrinter();

            printer.Title               = "ايرادات";
            printer.PageNumbers         = true;
            printer.PageNumberInHeader  = false;
            printer.PorportionalColumns = true;
            printer.HeaderCellAlignment = StringAlignment.Near;
            printer.printDocument.DefaultPageSettings.Landscape = true;
            Margins margins = new Margins(0, 0, 0, 0);

            printer.printDocument.DefaultPageSettings.Margins     = margins;
            this.dataGridView1_add_Revenues.Columns["ID"].Visible = false;
            printer.PrintPreviewNoDisplay(dataGridView1_add_Revenues);
            this.dataGridView1_add_Revenues.Columns["ID"].Visible = true;
        }
Exemple #6
0
        public override void PrintPreview()
        {
            DGVPrinter printer = new DGVPrinter();
            printer.Title = "Meriweather Mowing Service";
            printer.SubTitle = "Service Type Listing";
            printer.SubTitleFormatFlags = StringFormatFlags.LineLimit |
                                          StringFormatFlags.NoClip;
            printer.PageNumbers = true;
            printer.PageNumberInHeader = false;
            printer.PorportionalColumns = true;
            printer.HeaderCellAlignment = StringAlignment.Near;
            printer.Footer = "Meriweather Management System";
            printer.FooterSpacing = 15;

            // use saved settings
            if (null != MMSUtility.myPrinterSettings)
                printer.printDocument.PrinterSettings = MMSUtility.myPrinterSettings;

            if (null != MMSUtility.myPageSettings)
                printer.printDocument.DefaultPageSettings = MMSUtility.myPageSettings;

            if (DialogResult.OK == printer.DisplayPrintDialog())  // replace DisplayPrintDialog()
            // with your own print dialog
            {
                // save users' settings
                MMSUtility.myPrinterSettings = printer.PrintSettings;
                MMSUtility.myPageSettings = printer.PageSettings;

                // print without displaying the printdialog
                printer.PrintPreviewNoDisplay(serviceDataGridView);
            }
        }