public ScenarioResult Hotkey_Ctrl_1(TParams p)
 {
     printPreviewDialog.Show();
     p.log.WriteLine("Press Ctrl+1");
     SendKeys.SendWait("^1");
     return(new ScenarioResult(printPreviewDialog.PrintPreviewControl.Rows == 1 && printPreviewDialog.PrintPreviewControl.Columns == 1));
 }
Ejemplo n.º 2
0
        void PrintButtonClick(object sender, EventArgs e)
        {
            try
            {
                streamToPrint = new StreamReader
                                    ("C:\\Users\\Juan Carlos\\Documents\\MyFile.txt");
                try
                {
                    //Create a PrintPreviewDialog object
                    PrintPreviewDialog previewDlg = new PrintPreviewDialog();

                    printFont = new Font("Arial", 10);
                    PrintDocument pd = new PrintDocument();
                    pd.PrintPage += new PrintPageEventHandler
                                        (this.pd_PrintPage);

                    //Set Document property of PrintPreviewDialog
                    previewDlg.Document = pd;
                    //Display dialog
                    previewDlg.Show();

                    //pd.Print(); //Lo saco por ahora
                }
                finally
                {
                    streamToPrint.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 3
0
        public void PrintResult()
        {
            try
            {
                if (listViewEvent.SelectedItems.Count > 0)
                {
                    PrintPreviewDialog printPreviewDialog1 = new PrintPreviewDialog();
                    PrintDocument      pd = new PrintDocument();

                    printPreviewDialog1.Document = pd;
                    printPreviewDialog1.Size     = new System.Drawing.Size(350, 550);
                    printPreviewDialog1.Show();
                    pd.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.pd_PrintPage);
                    pd.DefaultPageSettings.PaperSize = new PaperSize("A4", 827, 1170);
                    pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
                }
                else
                {
                    MessageBox.Show("Välj ett event, försök igen", "Fel format", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 4
0
        private void button9_BaskiOnIzlemeYap_Click(object sender, EventArgs e)
        {
            if (dataGridView1_YapilanTahlilVeIslemler.RowCount <= 0)
            {
                MessageBox.Show("Lütfen Öncelikle Sorgulama Yapınız.");
                return;
            }

            DOKTOR_AD = DoktorAdSorgulama();

            if (DOKTOR_AD != "" && DOKTOR_AD != null)
            {
                yazdirma_OnizlemeIslemleri();

                PrintPreviewDialog onizleme = new PrintPreviewDialog();
                onizleme.Document  = printDocument1;
                onizleme.MdiParent = Program.anaekran;
                onizleme.Show();

                // onizleme.ShowDialog();
            }
            else
            {
                MessageBox.Show("Doktor Sorgulama Hatası");
            }

            // işlem sonrasında aktif etmeliyiz
            yazdirma_sirasinda_veri_ekleme_yapildi_FiyatHesaplama_devre_disi = false;
            // yazdirma işlemi için eklediğimiz verileri siliyoruz.
            yazdirmaSonrasiFazlaEkledigimizVerileriSilme();
        }
Ejemplo n.º 5
0
 public override void Run()
 {
     try {
         IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
         if (window != null)
         {
             if (window.ViewContent is IPrintable)
             {
                 using (PrintDocument pdoc = ((IPrintable)window.ViewContent).PrintDocument) {
                     if (pdoc != null)
                     {
                         PrintPreviewDialog ppd = new PrintPreviewDialog();
                         ppd.Owner    = (Form)WorkbenchSingleton.Workbench;
                         ppd.TopMost  = true;
                         ppd.Document = pdoc;
                         ppd.Show();
                     }
                     else
                     {
                         MessageService.ShowError("${res:ICSharpCode.SharpDevelop.Commands.Print.CreatePrintDocumentError}");
                     }
                 }
             }
         }
     } catch (InvalidPrinterException) {}
 }
Ejemplo n.º 6
0
 private void btnProcessUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         //UPDADE ORDER TABLE
         using (ShopDBEntities db = new ShopDBEntities())
         {
             string orderNo     = txtUpdateOrderNo.Text;
             var    updateOrder = db.Orders.SingleOrDefault(c => c.OrderNo == orderNo);
             updateOrder.TotalPayment = Convert.ToDecimal(txtTotalPayment.Text);
             if (txtPaymentDue.Text.Trim() == "0.00" || Convert.ToDecimal(txtPaymentDue.Text) == 0)
             {
                 updateOrder.OrderStatusID = 1;
             }
             else
             {
                 updateOrder.OrderStatusID = 2;
             }
             db.Entry(updateOrder).State = EntityState.Modified;
             db.SaveChanges();
             DialogResult result = MessageBox.Show("Print Slip?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if (result == DialogResult.Yes)
             {
                 InvoiceType = "Update Order";
                 PrintPreviewDialog.Document = PrintDocument;
                 PrintPreviewDialog.Show();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 7
0
        public override void Run()
        {
            try
            {
                IViewContent content = WorkbenchSingleton.Workbench.ActiveViewContent;

                if (content != null)
                {
                    if (content is IPrintable)
                    {
                        using (PrintDocument pdoc = ((IPrintable)content).PrintDocument)
                        {
                            if (pdoc != null)
                            {
                                PrintPreviewDialog ppd = new PrintPreviewDialog();
                                ppd.Owner    = (Form)WorkbenchSingleton.Workbench;
                                ppd.TopMost  = true;
                                ppd.Document = pdoc;
                                ppd.Show();
                            }
                            else
                            {
                                MessageBox.Show("Couldn't create PrintDocument", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                    }
                }
            }
            catch (System.Drawing.Printing.InvalidPrinterException)
            {
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Preview the content of the grid to be print
        /// </summary>
        private void button1_Click_1(object sender, EventArgs e)
        {
            try
            {
                this.gridControl1.Model.Properties.PrintFrame = false;

                Syncfusion.GridHelperClasses.GridPrintDocumentAdv pd = new Syncfusion.GridHelperClasses.GridPrintDocumentAdv(this.gridControl1);
                pd.DefaultPageSettings.Margins = new System.Drawing.Printing.Margins(25, 25, 25, 25);

                if (this.ShowHeaderFooter.Checked)
                {
                    pd.HeaderHeight = 70;
                    pd.FooterHeight = 50;
                }
                else
                {
                    pd.HeaderHeight = 0;
                    pd.HeaderHeight = 0;
                }

                pd.ScaleColumnsToFitPage = this.ScaleColumnsToFit.Checked;

                pd.DrawGridPrintHeader += new Syncfusion.GridHelperClasses.GridPrintDocumentAdv.DrawGridHeaderFooterEventHandler(pd_DrawGridPrintHeader);
                pd.DrawGridPrintFooter += new Syncfusion.GridHelperClasses.GridPrintDocumentAdv.DrawGridHeaderFooterEventHandler(pd_DrawGridPrintFooter);

                PrintPreviewDialog previewDialog = new PrintPreviewDialog();
                previewDialog.Document = pd;
                previewDialog.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error while print preview" + ex.ToString());
            }
        }
Ejemplo n.º 9
0
 void Button1Click(object sender, EventArgs e)
 {
     _dataSet.Clear();
     _dataSet.DataSetName = "balance";
     if (checkBox1.Checked)
     {
         _mySQL.SelectSqlCommand = "SELECT * FROM balance ORDER BY balance_tmc ASC";
     }
     else
     {
         _mySQL.SelectSqlCommand = "SELECT * FROM balance WHERE (balance_date BETWEEN '" + dateTimePicker1.Text + "' AND '" + dateTimePicker2.Text + "') ORDER BY balance_tmc ASC";
     }
     if (_mySQL.ExecuteFill(_dataSet, "balance"))
     {
         // ФОРМИРУЕМ ОТЧЁТ
         PrintPreviewDialog ppd = new PrintPreviewDialog();
         ppd.Document  = printDocument1;
         ppd.MdiParent = ClassForms.Rapid_Client;
         ppd.Show();
     }
     else
     {
         ClassForms.Rapid_Client.MessageConsole("Отчёт Остатки ТМЦ: Ошибка вывода информации.", true);
     }
 }
Ejemplo n.º 10
0
        private void btnFullScreenCapture_Click(object sender, EventArgs e)
        {
            Graphics myGraphics = this.CreateGraphics();
            Size     s          = Screen.PrimaryScreen.WorkingArea.Size;
            IntPtr   hdc        = GetDC(IntPtr.Zero);
            float    ScaleX     = (float)GetDeviceCaps(hdc, DESKTOPHORZRES) / (float)GetDeviceCaps(hdc, HORZRES);
            float    ScaleY     = (float)GetDeviceCaps(hdc, DESKTOPVERTRES) / (float)GetDeviceCaps(hdc, VERTRES);

            ReleaseDC(IntPtr.Zero, hdc);
            int ScreenWidth  = (int)(SystemInformation.PrimaryMonitorSize.Width * ScaleX);
            int ScreenHeight = (int)(SystemInformation.PrimaryMonitorSize.Height * ScaleY);

            myImage = new Bitmap(ScreenWidth, ScreenHeight, myGraphics);
            Graphics memoryGraphics = Graphics.FromImage(myImage);

            memoryGraphics.CopyFromScreen(new Point(0, 0), new Point(0, 0), new Size(ScreenWidth, ScreenHeight));
            printDocument1.DefaultPageSettings.PaperSize = new PaperSize("Full size", ScreenWidth, ScreenHeight);
            printPreviewDialog1          = new PrintPreviewDialog();
            printPreviewDialog1.Document = printDocument1;
            //預覽列印
            printPreviewDialog1.Show();
            myGraphics.Dispose();
            ReleaseDC(IntPtr.Zero, hdc);

            //全螢幕截圖存檔
            Printsrc();
        }
Ejemplo n.º 11
0
        private void btnPrintPreview_Click(object sender, EventArgs e)
        {
            PrintPreviewDialog ppd = new PrintPreviewDialog();

            ppd.Document = WarrantPrintDocument;
            ppd.Show();
        }
 private void btnPrintpreview_Click(object sender, EventArgs e)
 {
     // 初始化当前打印页码
     m_CurrentPrintPage           = 0;
     document.DocumentName        = PrintPagelayoutControl.DocumentFilename;
     printPreviewDialog1.Document = document;
     printPreviewDialog1.Show();
 }
Ejemplo n.º 13
0
        private void button3_Click(object sender, EventArgs e)
        {
            PrintPreviewDialog p = report.PreviewPrintReport();

            panel1.Controls.Add(p);
            p.Show();
            panel1.Refresh();
        }
Ejemplo n.º 14
0
        private void PrintPreview()
        {
            PrintPreviewDialog previewDialog = new PrintPreviewDialog();
            PrintDocument      doc           = new PrintDocument();

            doc.PrintPage         += new PrintPageEventHandler(CreatePage);
            previewDialog.Document = doc;
            previewDialog.Show();
        }
Ejemplo n.º 15
0
        private void button3_Click(object sender, EventArgs e)
        {
            listIndex   = 0;
            itemPerPage = 0;
            PrintPreviewDialog printPreview = new PrintPreviewDialog();

            printPreview.Document = printDocument1;
            printPreview.Show();
        }
Ejemplo n.º 16
0
        void Button17Click(object sender, EventArgs e)
        {
            // просмотр бланка отчета
            PrintPreviewDialog ppd = new PrintPreviewDialog();

            ppd.Document  = printDocument1;
            ppd.MdiParent = ClassForms.Rapid_Client;
            ppd.Show();
        }
Ejemplo n.º 17
0
        void ButtonPrintPreviewClick(object sender, EventArgs e)
        {
            printLine = 0;
            PrintPreviewDialog ppd = new PrintPreviewDialog();

            ppd.Document  = printDocument1;
            ppd.MdiParent = DataForms.FClient;
            ppd.Show();
        }
Ejemplo n.º 18
0
        private void PrintForm_Shown(object sender, EventArgs e)
        {
            PrintPreviewDialog p = report.PreviewPrintReport();

            this.Controls.Add(p);
            p.WindowState     = FormWindowState.Maximized;
            p.FormBorderStyle = FormBorderStyle.None;
            p.Show();
        }
Ejemplo n.º 19
0
        private void PrintForm_Load(object sender, EventArgs e)
        {
            base.CheckUserPermission(this);
            PrintPreviewDialog p = report.PreviewPrintReport();

            this.Controls.Add(p);
            p.Show();
            //this.Refresh();
        }
Ejemplo n.º 20
0
        private void button2_Click(object sender, EventArgs e)
        {
            PrintPreviewDialog PrintPreviewDlg = new PrintPreviewDialog();

            PrintPreviewDlg.Document            = Document;
            ((Form)PrintPreviewDlg).WindowState = FormWindowState.Maximized;
            // Ejecutar maximizado.
            PrintPreviewDlg.Show();
        }
Ejemplo n.º 21
0
        /// <summary>
        ///     Shows a PrintPreview dialog displaying the Tree control passed in.
        /// </summary>
        /// <param name="tree">TreeView to print preview</param>
        /// <param name="reportTitle"></param>
        public void PrintPreviewTree(TreeView tree, string reportTitle)
        {
            this.title = reportTitle;
            this.PrepareTreeImage(tree);
            var pp = new PrintPreviewDialog {
                Document = this.printDoc
            };

            pp.Show();
        }
        private void button3_Click(object sender, EventArgs e)
        {
            PrintDocument xDoc = new PrintDocument();

            xDoc.PrintPage += new PrintPageEventHandler(xDoc_PrintPage);
            PrintPreviewDialog PPD = new PrintPreviewDialog();

            PPD.Document = xDoc;
            PPD.Show();
        }
Ejemplo n.º 23
0
 private void button3_Click(object sender, EventArgs e)
 {
     PDoc = new PrintDocument();
     PDoc.DocumentName  = "Spirograph";
     PDoc.PrintPage    += new PrintPageEventHandler(PDoc_PrintPage);
     pView              = new PrintPreviewDialog();
     pView.Document     = PDoc;
     pView.UseAntiAlias = true;
     pView.Show();
 }
Ejemplo n.º 24
0
        int nReg; // será usado para posicionar os registros

        private void btnImprimir_Click(object sender, EventArgs e)
        {
            PrintDocument pDoc = new PrintDocument();
            Button        btn  = (Button)sender;

            if (btn.Name == "btnImprimir")
            {
                pDoc.PrintPage += new PrintPageEventHandler(pDoc_PrintPageUnico);
            }
            else
            {
                // Para imprimir dados vindo de uma tabela de um banco de dados
                // é preciso definir conexões ao banco, com senhas, executar SELECTs.
                // Neste exemplo abaixo estou criando 5 registros em memoria e
                // recalculando o boleto para cada página impressa
                // Customize de acordo com suas necessidades, pois este é apenas um exemplo
                // basico por isso serão utilizados apenas poucos campos.

                tbDados = new DataTable(); // Cria  atabela em memoria

                // Cria as colunas nos respectivos tipos
                tbDados.Columns.Add("Nome", typeof(string));
                tbDados.Columns.Add("Vencimento", typeof(DateTime));
                tbDados.Columns.Add("Valor", typeof(double));
                tbDados.Columns.Add("NossoNumero", typeof(int));

                // insere os dados
                tbDados.Rows.Add("Fabio", new DateTime(2008, 12, 30), 123.45, 345678);
                tbDados.Rows.Add("Érika", new DateTime(2008, 7, 25), 60, 12332);
                tbDados.Rows.Add("Milena", new DateTime(2008, 10, 20), 10.30, 234);
                tbDados.Rows.Add("Cliente", DateTime.MinValue, 200.55, 456445);
                tbDados.Rows.Add("qualquer um", new DateTime(2008, 2, 12), 7890.5, 56756);

                // posiciona o registro atual
                pDoc.PrintPage += new PrintPageEventHandler(pDoc_PrintPageTabela);
            }

            nReg = 0;
            pDoc.DefaultPageSettings.Landscape = chkCarne.Checked;

            if (chkPreview.Checked)
            {
                PrintDialog        dlgPrinter = new PrintDialog();
                PrintPreviewDialog ppw        = new PrintPreviewDialog();
                ppw.Document    = pDoc;
                ppw.MdiParent   = this.MdiParent;
                ppw.WindowState = FormWindowState.Maximized;
                ppw.Show();
            }
            else
            {
                pDoc.Print();
                this.Close();
            }
        }
        //printeaza datele din grid view
        private void aAaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PrintDocument pd = new PrintDocument();

            pd.PrintPage += Pd_PrintPage;

            PrintPreviewDialog ppd = new PrintPreviewDialog();

            ppd.Document = pd;
            ppd.Show();
        }
Ejemplo n.º 26
0
        private void m_pPrintPreview_Click(object sender, System.EventArgs e)
        {
            PrintDocument tmpprndoc = new PrintDocument();

            tmpprndoc.PrintPage += new PrintPageEventHandler(toPrinter);

            PrintPreviewDialog tmpprdiag = new PrintPreviewDialog();

            tmpprdiag.Document = tmpprndoc;
            tmpprdiag.Show();
        }
Ejemplo n.º 27
0
        private void butPreview_Click(object sender, EventArgs e)
        {
            // Создаем документ и прикрепляем к нему обработчик события
            PrintDocument doc = new PrintDocument();

            doc.PrintPage += this.Doc_PrintPage;

            PrintPreviewDialog dlgPreview = new PrintPreviewDialog();

            dlgPreview.Document = doc;
            dlgPreview.Show();
        }
Ejemplo n.º 28
0
        //private void Preview_Click(object sender, EventArgs e)
        //{
        //    PrintDocument printDocument = new PrintDocument();

        //    printDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(CreateTable);

        //    PrintPreviewDialog preview = new PrintPreviewDialog();

        //    preview.Document = printDocument;

        //    preview.Show();
        //}

        private void m_ButtonPreview_Click(object sender, EventArgs e)
        {
            PrintDocument printDocument = new PrintDocument();

            printDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(CreateTable);

            PrintPreviewDialog preview = new PrintPreviewDialog();

            preview.Document = printDocument;

            preview.Show();
        }
        public void PrintPreviewTree(System.Windows.Forms.TreeView tree, string title, Font fnt)
        {
            this._title     = title;
            this.headerfont = new Font(FontFamily.GenericSansSerif, 16f, FontStyle.Bold, GraphicsUnit.Point);
            if (fnt != null)
            {
                this.headerfont = fnt;
            }
            this.PrepareTreeImage(tree);
            PrintPreviewDialog dialog = new PrintPreviewDialog();

            dialog.Document = this._printDoc;
            dialog.Show();
        }
Ejemplo n.º 30
0
        private void previewToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Создаем документ и прикрепляем к нему обработчик события
            PrintDocument doc = new PrintDocument();

            // Происходит, когда необходимо вывести на печать текущую страницу.
            doc.PrintPage += this.Doc_PrintPage;

            // стандартное диалоговое окно предварительного просмотра
            PrintPreviewDialog dlgPreview = new PrintPreviewDialog();

            dlgPreview.Document = doc;
            dlgPreview.Show();
        }