public rpt_honorario_med(int PidPaciente_, int folioservicio_, string _nombrebd_, string entry_fecha_admision_, string entry_hora_registro_,
                                 string entry_fechahora_alta_, string entry_nombre_paciente_, string entry_telefono_paciente_, string entry_doctor_,
                                 string entry_tipo_paciente_, string entry_aseguradora_, string edadpac_, string fecha_nacimiento_, string dir_pac_,
                                 string cirugia_, string empresapac_, int idtipopaciente_, string honorario_med_, string numfactu_)
        {
            PidPaciente       = PidPaciente_;             //
            folioservicio     = folioservicio_;           //
            nombrebd          = _nombrebd_;               //
            fecha_admision    = entry_fecha_admision_;    //
            hora_registro     = entry_hora_registro_;     //
            fechahora_alta    = entry_fechahora_alta_;    //
            nombre_paciente   = entry_nombre_paciente_;   //
            telefono_paciente = entry_telefono_paciente_; //
            doctor            = entry_doctor_;            //
            cirugia           = cirugia_;                 //
            tipo_paciente     = entry_tipo_paciente_;     //
            id_tipopaciente   = idtipopaciente_;
            aseguradora       = entry_aseguradora_;       //
            edadpac           = edadpac_;                 //
            fecha_nacimiento  = fecha_nacimiento_;        //
            dir_pac           = dir_pac_;                 //
            empresapac        = empresapac_;              //
            honorario_med     = honorario_med_;
            numfactu          = numfactu_;


            PrintJob    trabajo   = new PrintJob(PrintConfig.Default());
            PrintDialog dialogo   = new PrintDialog(trabajo, "RESUMEN DE FACTURA", 0);
            int         respuesta = dialogo.Run();

            if (respuesta == (int)PrintButtons.Cancel)
            {
                dialogo.Hide();
                dialogo.Dispose();
                return;
            }
            PrintContext ctx = trabajo.Context;

            ComponerPagina(ctx, trabajo);
            trabajo.Close();
            switch (respuesta)
            {
            case (int)PrintButtons.Print:
                trabajo.Print();
                break;

            case (int)PrintButtons.Preview:
                new PrintJobPreview(trabajo, "RESUMEN DE FACTURA").Show();
                break;
            }
            dialogo.Hide(); dialogo.Dispose();
        }
示例#2
0
        internal void Print()
        {
            if (_isDisposed)
            {
                throw new ObjectDisposedException(_className);
            }

            PrintDialog   printDialog = new PrintDialog();
            PrintDocument printImage  = new PrintDocument();

            printImage.DocumentName = "Cropper Captured Image";
            printImage.PrintPage   += new PrintPageEventHandler(OnPrintPage);

            printDialog.Document = printImage;

            DialogResult result = printDialog.ShowDialog();

            // Send print message
            try
            {
                if (result == DialogResult.OK)
                {
                    printImage.Print();
                }
            }
            catch (InvalidPrinterException)
            {
                ShowPrintError();
            }
            finally
            {
                printImage.Dispose();
                printDialog.Dispose();
            }
        }
示例#3
0
        private void BtnContinue_Click(object sender, EventArgs e)
        {
            for (var i = 0; i < book.Words.Count; i++) // Compose print list
            {
                if (ListBox.GetItemChecked(i))
                {
                    printList.Add(book.Words[i]);
                }
            }

            var dialog = new PrintDialog
            {
                AllowCurrentPage = false,
                AllowSomePages   = false,
                UseEXDialog      = true
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                invertSides = RbAskForMotherTongue.Checked;

                PrintList.PrinterSettings = dialog.PrinterSettings;
                PrintList.DocumentName    = book.Name ?? Words.Vocup;
                PrintList.Print();
            }

            dialog.Dispose();
        }
示例#4
0
        private void button1_Click(object sender, EventArgs e)
        {
            string      descripcion = "Aspirina tabletas";
            int         cantidad    = 2;
            double      precio      = 45.25;
            double      total       = 90.5;
            PrintDialog pd          = new PrintDialog();

            pd.PrinterSettings = new PrinterSettings();

            if (DialogResult.OK == pd.ShowDialog(this))
            {
                pd.PrinterSettings.PrintToFile = true;

                CreaTicket Ticket1 = new CreaTicket(pd.PrinterSettings.PrinterName);
                Ticket1.AbreCajon();                                          //abre el cajon
                Ticket1.TextoCentro("Venta mostrador Ñ");                     // imprime en el centro "Venta mostrador"
                Ticket1.LineasGuion();                                        // imprime una linea de guiones
                Ticket1.EncabezadoVenta();                                    // imprime encabezados
                Ticket1.AgregaArticulo(descripcion, cantidad, precio, total); //imprime una linea de descripcion
                Ticket1.LineasTotales();                                      // imprime linea
                Ticket1.AgregaTotales("Total", total);                        // imprime linea con total
                Ticket1.CortaTicket();                                        // corta el ticket
            }

            pd.Dispose();
        }
        private void B_PrintDialog_Click(object sender, EventArgs e)
        {
            PrintDialog dlg = new PrintDialog();

            dlg.ShowDialog();
            dlg.Dispose();
        }
        private void Print()
        {
            PrintDialog   printDialog = new PrintDialog();
            PrintDocument printImage  = new PrintDocument();

            printImage.DocumentName = "Cropper Captured Image";
            printImage.PrintPage   += OnPrintPage;

            printDialog.Document = printImage;

            DialogResult result = printDialog.ShowDialog();

            // Send print message
            try
            {
                if (result == DialogResult.OK)
                {
                    printImage.Print();
                }
            }
            catch (InvalidPrinterException)
            {
                ShowPrintError();
            }
            finally
            {
                printImage.Dispose();
                printDialog.Dispose();
            }
        }
示例#7
0
        public static void PrintScreen(string FileName)
        {
            PrintDialog1                  = new PrintDialog();
            PrintDialog1.UseEXDialog      = true;
            PrintDialog1.AllowPrintToFile = false;
            PrintDialog1.AllowCurrentPage = false;
            PrintDialog1.AllowSelection   = false;
            PrintDialog1.AllowSomePages   = false;
            PrtDoc            = new PrintDocument();
            PrtDoc.PrintPage += PrtDoc_PrintPage;
            Bitmap   capture;
            Graphics graph;

            capture = (Bitmap)Image.FromFile(FileName);
            graph   = Graphics.FromImage(capture);
            if (My.MyProject.Computer.FileSystem.FileExists(PrtFileName))
            {
                My.MyProject.Computer.FileSystem.DeleteFile(PrtFileName);
            }

            capture.Save(PrtFileName);
            PrtDoc.DocumentName   = PrtFileName;
            PrintDialog1.Document = PrtDoc;
            if (PrintDialog1.ShowDialog() == DialogResult.OK)
            {
                PrtDoc.Print();
            }

            capture.Dispose();
            PrintDialog1.Dispose();
            PrtDoc.Dispose();
            return;
        }
 public PrintReport(string imageFileName)
 {
     _doc           = new PrintDocument();
     _imageFileName = imageFileName;
     try
     {
         _doc.PrintPage += new PrintPageEventHandler(_doc_PrintPage);
         _doc.PrinterSettings.DefaultPageSettings.Landscape = true;
         _doc.PrinterSettings.DefaultPageSettings.Margins   = new Margins(50, 50, 50, 50);
         var dialog = new PrintDialog();
         dialog.Document = _doc;
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             PrintPreviewDialog prev = new PrintPreviewDialog();
             prev.Document = _doc;
             prev.ShowDialog();
             prev.Dispose();
             //_doc.Print();
         }
         dialog.Dispose();
         _doc.Dispose();
     }
     catch (Exception error)
     {
         MessageBox.Show("Error imprimiendo.", "UTN Emall", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#9
0
        private void printPhysical()
        {
            printIndex = 0;

            PrintDialog pDiag = new PrintDialog();

            if (pDiag.ShowDialog() == DialogResult.OK)
            {
                PrinterSettings ps = pDiag.PrinterSettings;

                ps.DefaultPageSettings.PaperSize = GetPaperSize(ps, this.sheets[0].PaperType);
                ps.DefaultPageSettings.Landscape = this.sheets[0].IsLandscape;
                ps.DefaultPageSettings.Margins   = GetMargins(ps);

                PrintDocument pd = new PrintDocument();
                pd.PrintPage      += printAllSheets;
                pd.PrinterSettings = ps;

                EnterEditMode();
                pd.Print();
            }

            pDiag.Dispose();
            this.Close();

            /*PrintPreviewDialog ppd = new PrintPreviewDialog();
             * ppd.Document = pd;
             * ppd.ShowDialog();*/
        }
示例#10
0
        //Method to sort by the employee's first name
        private void byEmployeeFirstNameToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int    i          = 3;
            string sortedPath = @"C:\MMT Temp Services\Sorted Employees.txt";

            Tools.importReadCreate(mainEvalFilePath, i);
            printFilePath = sortedPath;
            PrintDocument printDoc = new PrintDocument();

            printDoc.PrintPage += new PrintPageEventHandler(PrintPage);
            PrintDialog printDiagBox = new PrintDialog();

            printFont             = new System.Drawing.Font("Arial", 10);
            printDiagBox.Document = printDoc;
            if (MessageBox.Show("Would you like to preview the document before printing?", "Alert", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                PrintPreviewDialog printPrev = new PrintPreviewDialog();
                printPrev.Width    = 725;
                printPrev.Height   = 850;
                printPrev.Document = printDoc;
                printPrev.ShowDialog();
            }
            if (printDiagBox.ShowDialog() == DialogResult.OK)
            {
                printDoc.DocumentName = printFilePath;
                printDoc.Print();
                printDiagBox.Dispose();
                printDoc.Dispose();
            }
            else
            {
                MessageBox.Show("Cancelled the print job.");
            }
        }
示例#11
0
        private void SendToPrinter()
        {
            if (m_streams == null || m_streams.Count == 0)
            {
                throw new Exception("Error: no stream to print.");
            }
            PrintDocument printDoc = new PrintDocument();

            PrintDialog dialogue = new PrintDialog();

            DialogResult dr = dialogue.ShowDialog();

            if (dr == DialogResult.OK)
            {
                printDoc.PrinterSettings = dialogue.PrinterSettings;
            }
            dialogue.Dispose();

            if (!printDoc.PrinterSettings.IsValid)
            {
                throw new Exception("Error: cannot find the default printer.");
            }
            else
            {
                printDoc.PrintPage += new PrintPageEventHandler(PrintPage);
                m_currentPageIndex  = 0;
                printDoc.Print();
            }
        }
示例#12
0
        //Method to sort by the employee's first name
        private void byEmployeeFirstNameToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int    i          = 3;
            string sortedPath = @"C:\MMT Temp Services\Sorted Employees.txt";

            Tools.importReadCreate(mainEvalFilePath, i);
            printFilePath = sortedPath;
            PrintDocument printDoc = new PrintDocument();

            printDoc.PrintPage += new PrintPageEventHandler(PrintPage);
            PrintDialog printDiagBox = new PrintDialog();

            printFont             = new System.Drawing.Font("Arial", 10);
            printDiagBox.Document = printDoc;
            if (printDiagBox.ShowDialog() == DialogResult.OK)
            {
                printDoc.DocumentName = printFilePath;
                printDoc.Print();
                printDiagBox.Dispose();
                printDoc.Dispose();
            }
            else
            {
                MessageBox.Show("Cancelled the print job.");
            }
        }
示例#13
0
        protected virtual PrinterSettings ShowPrintSetupDialog(System.Drawing.Printing.PrintDocument printDocument_1)
        {
            this.ThrowPrintDocumentNullException(printDocument_1);
            PrinterSettings printerSettings = new PrinterSettings();
            PrintDialog     dialog          = new PrintDialog();

            try
            {
                dialog.AllowSomePages = true;
                dialog.Document       = printDocument_1;
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    printerSettings = dialog.PrinterSettings;
                    printDocument_1.Print();
                }
            }
            catch (InvalidPrinterException exception)
            {
                this.ShowInvalidPrinterException(exception);
            }
            catch (Exception exception2)
            {
                this.ShowPrinterException(exception2);
            }
            finally
            {
                dialog.Dispose();
                dialog = null;
            }
            return(printerSettings);
        }
示例#14
0
 /**
  * This Dispose is called from the Dispose and the Destructor.
  * When disposing==true all non-managed resources should be freed too!
  */
 protected void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (image != null)
         {
             image.Dispose();
         }
         if (printDocument != null)
         {
             printDocument.Dispose();
         }
         if (printDialog != null)
         {
             printDialog.Dispose();
         }
         if (printOptionsDialog != null)
         {
             printOptionsDialog.Dispose();
         }
     }
     image              = null;
     printDocument      = null;
     printDialog        = null;
     printOptionsDialog = null;
 }
        /// <summary>
        /// Raises the PrintSetup dialog to manage the printer settings
        /// </summary>
        public virtual void PrintSetup()
        {
            PrintDialog pd = new PrintDialog();

            pd.PrinterSettings = printSettings;
            pd.ShowDialog();
            pd.Dispose();
        }
示例#16
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         printDocument.Dispose();
         printDialog.Dispose();
         printPreviewDialog.Dispose();
     }
 }
示例#17
0
        /**
         * This Dispose is called from the Dispose and the Destructor.
         * When disposing==true all non-managed resources should be freed too!
         */

        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                _printDocument?.Dispose();
                _printDialog?.Dispose();
            }
            _surface       = null;
            _printDocument = null;
            _printDialog   = null;
        }
示例#18
0
 protected virtual void Dispose(bool disposing)
 {
     try
     {
         if (disposing)
         {
             printDocument.Dispose();
             printDialog.Dispose();
             printPreviewDialog.Dispose();
         }
     }
     catch (Exception) { }
 }
示例#19
0
        private void button3_Click(object sender, EventArgs e)
        {
            PrintDialog MyPrintDialog = new PrintDialog();

            MyPrintDialog.AllowCurrentPage            = false;
            MyPrintDialog.AllowPrintToFile            = false;
            MyPrintDialog.AllowSelection              = false;
            MyPrintDialog.AllowSomePages              = false;
            MyPrintDialog.PrintToFile                 = false;
            MyPrintDialog.ShowHelp                    = false;
            MyPrintDialog.ShowNetwork                 = false;
            MyPrintDialog.PrinterSettings.PrinterName = admin.Settings["printer_result"].ToString();

            printDocument1.PrinterSettings               = MyPrintDialog.PrinterSettings;
            printDocument1.DefaultPageSettings           = MyPrintDialog.PrinterSettings.DefaultPageSettings;
            printDocument1.DefaultPageSettings.Landscape = true;
            printDocument1.DefaultPageSettings.Color     = false;
            printDocument1.PrinterSettings.Copies        = Convert.ToInt16(numericUpDown1.Value);
            printDocument1.PrinterSettings.Collate       = true;
            printDocument1.DefaultPageSettings.Margins   = new Margins(10, 10, 10, 10);

            if (printDocument1.PrinterSettings.IsValid)
            {
                DateTime startTime = DateTime.Now;

                PrintRaceResult(CurrentRace.RaceID.ToString());

                TimeSpan executionTime = DateTime.Now - startTime;
                Logger.AddRecord("PrintRaceResult", Logger.LogType.info, executionTime);

                //MessageBox.Show(printDocument1.DefaultPageSettings.PaperSize.Width.ToString() + " " + printDocument1.DefaultPageSettings.PaperSize.Height.ToString());

                try
                {
                    printDocument1.Print();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Не удалось распечатать документ. Ошибка: " + ex.Message);
                }
                //  printPreviewDialog1.ShowDialog();

                MyPrintDialog.Dispose();
                this.Close();
            }
            else
            {
                MessageBox.Show("Не указан принтер для печати отчётов. Перейдите в раздел Управление - Настройки - Оборудование и выберите принтер в списке 'Печать результатов'");
            }
        }
            public void PrintCtrl(PrintScale scaling, Rectangle r, PageSettings ps, bool bitmap, bool preview)
            {
                _printScale = scaling;
                _bitmap     = bitmap;
                _printRect  = new RectangleF(r.X, r.Y, r.Width, r.Height);

                try
                {
                    PrintDocument pd = new PrintDocument();
                    pd.PrintPage += new PrintPageEventHandler(this.OnPrintCtrl);

                    if (ps != null)
                    {
                        pd.DefaultPageSettings = ps;
                        pd.PrinterSettings     = (_printHandler._printSettings == null)
                            ? ps.PrinterSettings : _printHandler.printSettings;
                    }
                    else
                    {
                        pd.DefaultPageSettings = _printHandler.pageSettings;
                        pd.PrinterSettings     = (_printHandler._printSettings == null)
                            ? ps.PrinterSettings : _printHandler.printSettings;
                    }

                    DialogResult dr = DialogResult.OK;

                    if (preview)
                    {
                        ChartPrinter.ChartPreviewDialogEx(pd, _printHandler._usePrintDialog);
                        _printHandler._printSettings = pd.PrinterSettings;
                    }
                    else
                    {
                        if (_printHandler._usePrintDialog)
                        {
                            PrintDialog px = new PrintDialog();
                            px.Document = pd;
                            dr          = px.ShowDialog();
                            px.Dispose();
                        }

                        if (dr == DialogResult.OK)
                        {
                            pd.Print();
                        }
                    }
                    pd.Dispose();
                }
                catch (Exception) {}
            }
示例#21
0
    public rptAdmision_fecha()
    {
        PrintJob    trabajo   = new PrintJob(PrintConfig.Default());
        PrintDialog dialogo   = new PrintDialog(trabajo, "Prueba", 0);
        int         respuesta = dialogo.Run();

        Console.WriteLine("Respuesta: " + respuesta);

        if (respuesta == (int)PrintButtons.Cancel)
        {
            Console.WriteLine("Impresión cancelada");
            dialogo.Hide();
            dialogo.Dispose();
            return;
        }

        PrintContext ctx = trabajo.Context;

        ComponerPagina(ctx, trabajo);

        trabajo.Close();

        switch (respuesta)
        {
        case (int)PrintButtons.Print:
            trabajo.Print();
            break;

        case (int)PrintButtons.Preview:
            Console.WriteLine("vista previa");
            new PrintJobPreview(trabajo, "Prueba").Show();
            break;
        }

        dialogo.Hide(); dialogo.Dispose();
    }
示例#22
0
 public void Dispose()
 {
     if (printDocument != null)
     {
         printDocument.Dispose();
     }
     if (printDialog != null)
     {
         printDialog.Dispose();
     }
     if (printPreviewDialog != null)
     {
         printPreviewDialog.Dispose();
     }
 }
示例#23
0
        private void imprimir()
        {
            PrintDialog printDialog = new PrintDialog();

            PrintDocument printDocument = new PrintDocument();

            printDialog.Document = printDocument;

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

            printDocument.Print();
            printDialog.Dispose();
            this.Show();
            return;
        }
示例#24
0
        public void PrinterSetting()
        {
            PrintDialog        pDlg  = new PrintDialog();
            PrintPreviewDialog ppDlg = new PrintPreviewDialog();

            try
            {
                //声明返回值的PrinterSettings
                PrinterSettings ps = new PrinterSettings();

                //可以选定页
                pDlg.AllowSomePages = true;

                //指定打印文档
                pDlg.Document = document;

                //显示对话框
                DialogResult result = pDlg.ShowDialog();
                if (result == DialogResult.OK)
                {
                    //保存打印设置
                    ps = pDlg.PrinterSettings;

                    ppDlg.Text        = "打印预览";
                    ppDlg.WindowState = FormWindowState.Maximized;
                    ppDlg.PrintPreviewControl.Zoom = 1;
                    //指定打印文档
                    ppDlg.Document = document;
                    ppDlg.ShowDialog();
                }
            }
            catch (System.Drawing.Printing.InvalidPrinterException e)
            {
                MessageBox.Show("请先在控制面板添加打印机!", "未找到打印机");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "打印错误");
            }
            finally
            {
                pDlg.Dispose();
                pDlg = null;
                ppDlg.Dispose();
                ppDlg = null;
            }
        }
示例#25
0
        public void imprimir(ReportClass reporte)//recibe un objeto repor,abre el dilogo impresora y si da si va a sacar las opciones,llama al metodo impri repor de donde a donde
        {
            PrintDialog dialog1 = new PrintDialog();

            if (dialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                int  copies   = dialog1.PrinterSettings.Copies;
                int  fromPage = dialog1.PrinterSettings.FromPage;
                int  toPage   = dialog1.PrinterSettings.ToPage;
                bool collate  = dialog1.PrinterSettings.Collate;

                reporte.PrintOptions.PrinterName = dialog1.PrinterSettings.PrinterName;
                reporte.PrintToPrinter(copies, collate, fromPage, toPage);
            }
            reporte.Dispose();
            dialog1.Dispose();
        }
 /**
  * This Dispose is called from the Dispose and the Destructor.
  * When disposing==true all non-managed resources should be freed too!
  */
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (printDocument != null)
         {
             printDocument.Dispose();
         }
         if (printDialog != null)
         {
             printDialog.Dispose();
         }
     }
     surface       = null;
     printDocument = null;
     printDialog   = null;
 }
示例#27
0
        public void PrintDialog()
        {
            PrintDocument printDoc = new PrintDocument();

            printDoc.PrintPage += EnvironmentPrint;
            PrintDialog dlg = new PrintDialog {
                Document = printDoc
            };

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                printDoc.Print();
            }

            dlg.Dispose();
            printDoc.Dispose();
        }
示例#28
0
        public void imprimir(ReportClass reporte)
        {
            PrintDialog dialog1 = new PrintDialog();

            if (dialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                int  copies   = dialog1.PrinterSettings.Copies;
                int  fromPage = dialog1.PrinterSettings.FromPage;
                int  toPage   = dialog1.PrinterSettings.ToPage;
                bool collate  = dialog1.PrinterSettings.Collate;

                reporte.PrintOptions.PrinterName = dialog1.PrinterSettings.PrinterName;
                reporte.PrintToPrinter(copies, collate, fromPage, toPage);
            }
            reporte.Dispose();
            dialog1.Dispose();
        }
示例#29
0
        public void CloseDrawArea()
        {
            //this.SuspendLayout();
            ////
            //// DrawArea
            ////
            //this.Load -= new System.EventHandler(this.DrawArea_Load);
            //this.Paint -= new System.Windows.Forms.PaintEventHandler(this.DrawArea_Paint);
            //this.KeyPress -= new System.Windows.Forms.KeyPressEventHandler(this.DrawArea_KeyPress);
            //this.MouseDoubleClick -= new System.Windows.Forms.MouseEventHandler(this.DrawArea_MouseDoubleClick);
            //this.MouseDown -= new System.Windows.Forms.MouseEventHandler(this.DrawArea_MouseDown);
            //this.MouseMove -= new System.Windows.Forms.MouseEventHandler(this.DrawArea_MouseMove);
            //this.MouseUp -= new System.Windows.Forms.MouseEventHandler(this.DrawArea_MouseUp);
            //this.ResumeLayout(false);
            //_currentPen.Dispose();
            //_currentBrush.Dispose();
            foreach (Control control in this.Controls)
            {
                control.Dispose();
            }

            PageSetupDialog1.Dispose();
            printdoc1.Dispose();
            previewdlg.Dispose();
            PrintDialog1.Dispose();

            if (tempobject != null)
            {
                tempobject.AreaPath.Dispose();
                tempobject.AreaPen.Dispose();
                tempobject.AreaRegion.Dispose();
            }
            //((ToolObject)tools[(int)DrawToolType.Pointer]).m_Cursor.Dispose();
            //((ToolObject)tools[(int)DrawToolType.Rectangle]).m_Cursor.Dispose();
            //((ToolObject)tools[(int)DrawToolType.Ellipse]).m_Cursor.Dispose();
            //((ToolObject)tools[(int)DrawToolType.Line]).m_Cursor.Dispose();
            //((ToolObject)tools[(int)DrawToolType.PolyLine]).m_Cursor.Dispose();
            //((ToolObject)tools[(int)DrawToolType.Text]).m_Cursor.Dispose();
            //((ToolObject)tools[(int)DrawToolType.Image]).m_Cursor.Dispose();
            //((ToolObject)tools[(int)DrawToolType.Variable]).m_Cursor.Dispose();
            //((ToolObject)tools[(int)DrawToolType.Function]).m_Cursor.Dispose();
            //((ToolObject)tools[(int)DrawToolType.FunctionBlock]).m_Cursor.Dispose();
            //((ToolObject)tools[(int)DrawToolType.Wire]).m_Cursor.Dispose();
            //((ToolObject)tools[(int)DrawToolType.Constant]).m_Cursor.Dispose();
        }
示例#30
0
        /// <summary>
        /// http://jeanne.wankuma.com/tips/csharp/dialog/print.html
        /// </summary>
        public static void PrintPage()
        {
            // PrintDialog の新しいインスタンスを生成する (デザイナから追加している場合は必要ない)
            PrintDialog printDialog1 = new PrintDialog();

            // PrinterSettings の新しいインスタンスを生成する (必須)
            printDialog1.PrinterSettings = new System.Drawing.Printing.PrinterSettings();
            // プリンタ名を指定する
            //printDialog1.PrinterSettings.PrinterName = "PrinterName";
            // 印刷範囲を「ページ指定」にする
            printDialog1.PrinterSettings.PrintRange = System.Drawing.Printing.PrintRange.SomePages;
            // 印刷範囲で指定可能な最大ページ数を設定する
            printDialog1.PrinterSettings.MaximumPage = short.MaxValue;
            // 印刷範囲で指定可能な最小ページ数を設定する
            printDialog1.PrinterSettings.MinimumPage = 1;
            // 印刷開始ページを設定する
            printDialog1.PrinterSettings.FromPage = 1;
            // 印刷終了ページを設定する
            printDialog1.PrinterSettings.ToPage = short.MaxValue;
            // [ファイルへ出力] チェックボックスを有効にする (初期値 true)
            //printDialog1.AllowPrintToFile = true;
            // [ファイルへ出力] チェックボックスをオンにする (初期値 false)
            printDialog1.PrintToFile = true;
            // 印刷範囲のページ指定を有効にする (初期値 false)
            printDialog1.AllowSelection = true;
            // 印刷範囲のページ指定を有効にする (初期値 false)
            printDialog1.AllowSomePages = true;
            // [部単位で印刷] チェックボックスをオンにする (初期値 true)
            //printDialog1.PrinterSettings.Collate = true;
            // 部数を設定する
            printDialog1.PrinterSettings.Copies = 8;
            // [ヘルプ] ボタンを表示する (初期値 false)
            printDialog1.ShowHelp = true;
            // [ネットワーク] ボタンを表示する (初期値 true)
            //printDialog1.ShowNetwork = true;
            // ダイアログを表示し、戻り値が [OK] の場合は印刷の処理を実行する
            if (printDialog1.ShowDialog() == DialogResult.OK)
            {
                MessageBox.Show("ここに、印刷の処理を実装してください");
                //this.currentWebBrowser().Print();
            }
            // 不要になった時点で破棄する (正しくは オブジェクトの破棄を保証する を参照)
            printDialog1.Dispose();
        }
        public void Print()
        {
            //		if (Html == null || Html == string.Empty) {
            //			Simple.ErrorAlert("Chyba při tisku", "Není co tisknout, prázdný dokument", parentWindow);
            //			return;
            //		}
            //
            string Caption = "Beline Printing";

            PrintJob pj = new PrintJob (PrintConfig.Default ());
            PrintDialog dialog = new PrintDialog (pj, Caption, 0);

            //		Gtk.HTML gtk_html = new Gtk.HTML (Html);
            html_panel.PrintSetMaster (pj);

            PrintContext ctx = pj.Context;
            html_panel.Print (ctx);

            pj.Close ();

            // hello user
            int response = dialog.Run ();

            if (response == (int) PrintButtons.Cancel) {
            dialog.Hide ();
            dialog.Dispose ();
            return;
            } else if (response == (int) PrintButtons.Print) {
            pj.Print ();
            } else if (response == (int) PrintButtons.Preview) {
            new PrintJobPreview (pj, Caption).Show ();
            }

            ctx.Close ();
            dialog.Hide ();
            dialog.Dispose ();
            return;
        }
            private void on_print_activate(object obj,
							EventArgs args)
            {
                if (viewer.GameViewerWidget.Games == null)
                    return;
                PrintWrapper printer = new PrintWrapper ();
                PrintDialog dialog =
                    new PrintDialog (printer.PrintJob,
                             Catalog.
                             GetString
                             ("Print PGN File"),
                             0);
                int response = dialog.Run ();

                if (response == (int) PrintButtons.Cancel)
                  {
                      dialog.Hide ();
                      dialog.Dispose ();
                      return;
                  }
                new PrintHandler (viewer,
                          viewer.GameViewerWidget.
                          Games, printer, response);

                dialog.Hide ();
                dialog.Dispose ();
            }