当前位置: 首页>>代码示例>>C#>>正文


C# PrintPreviewDialog.SetBounds方法代码示例

本文整理汇总了C#中System.Windows.Forms.PrintPreviewDialog.SetBounds方法的典型用法代码示例。如果您正苦于以下问题:C# PrintPreviewDialog.SetBounds方法的具体用法?C# PrintPreviewDialog.SetBounds怎么用?C# PrintPreviewDialog.SetBounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.PrintPreviewDialog的用法示例。


在下文中一共展示了PrintPreviewDialog.SetBounds方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PrintTokens

        public void PrintTokens(List<TokenPrint> tokens, Form parentDialog, string PrinterName, bool showPrintPreview)
        {
            _tokensToPrint = tokens;
            _pageCounter = 0;
            //bool showPrintPreview = true;
            PrintDocument pd = new PrintDocument();
            PrintDocument pd1 = new PrintDocument();

            pd.DefaultPageSettings.PaperSize = paperSize;
            pd.PrintPage += printDoc_PrintPage;
            pd.PrinterSettings.PrinterName = PrinterName;

            //ToDo: can remove preview in the actual production.
            if (showPrintPreview)
            {
                var ppDlg = new PrintPreviewDialog();
                ppDlg.SetBounds(30, 30, 1024, 500);
                ppDlg.PrintPreviewControl.AutoZoom = true;
                ppDlg.PrintPreviewControl.Zoom = 0.75;
                ppDlg.Document = pd;
                var dr = ppDlg.ShowDialog(parentDialog);
            }
            else
            {
                pd.Print();
            }
        }
开发者ID:akhilnaruto,项目名称:WinApp,代码行数:27,代码来源:PrintHelper.cs

示例2: printPreviewToolStripButton_Click

 private void printPreviewToolStripButton_Click(object sender, EventArgs e)
 {
     using (PrintDocument doc = grid.CreatePrintDocument())
     {
         using (PrintPreviewDialog ppd = new PrintPreviewDialog())
         {
             ppd.SetBounds(200, 200, 1024, 768);
             ppd.Document = doc;
             ppd.PrintPreviewControl.Zoom = 1d;
             ppd.ShowDialog(this);
         }
     }
 }
开发者ID:devfinity-fx,项目名称:cpms_z,代码行数:13,代码来源:ReoGridEditor.cs

示例3: button2_Click_1

        private void button2_Click_1(object sender, EventArgs e)
        {
            PrintPreviewDialog previewDialog = new PrintPreviewDialog();
            PrintDocument pd = new PrintDocument();

            pd.PrintPage += new PrintPageEventHandler(this.pd_Stampaj);

            previewDialog.Document = pd;
            previewDialog.SetBounds(50, -550, 200, 200);
            previewDialog.ShowDialog();
        }
开发者ID:ik15151,项目名称:etf-2011-ooad-biblioteka,代码行数:11,代码来源:PromjenaStudent.cs

示例4: _toolStripButtonPrint_Click

 private void _toolStripButtonPrint_Click(object sender, EventArgs e)
 {
     PrintDocument pd = new PrintDocument();
     pd.PrintPage += new PrintPageEventHandler(this.PrintDocumentOnPrintPage);
     pd.DefaultPageSettings.Landscape = false;
     PrintPreviewDialog dlg = new PrintPreviewDialog();
     dlg.Width = 100;
     dlg.MinimumSize = new Size(375, 250);
     dlg.SetBounds(100, -550, 800, 800);
     dlg.Document = pd;
     DialogResult result = dlg.ShowDialog();
 }
开发者ID:jpazarzis,项目名称:hogar,代码行数:12,代码来源:Summary.cs

示例5: printReviewToolStripMenuItem_Click

        private void printReviewToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PrintPreviewDialog ppd = new PrintPreviewDialog()
            {
                Document = new PrintDocument()
            };
            graph.Print(ppd.Document);

            ppd.PrintPreviewControl.Zoom = 1d;

            Rectangle screenSize = Screen.FromControl(this).WorkingArea;
            ppd.SetBounds(50, 50, screenSize.Width / 2, screenSize.Height - 100);

            ppd.ShowDialog();
        }
开发者ID:jing-lu,项目名称:PlainGraph,代码行数:15,代码来源:DemoForm.cs

示例6: unesi_Click

        private void unesi_Click(object sender, EventArgs e)
        {
            try
            {
                DAO dao = new DAO("etf.ba", "ooadtim6", "ooadtim6", "ooadtim6");
               // slika = new Bitmap(defaultpic);
                if (tabControl1.SelectedIndex == 0)
                {
                    if (ime.Text.Length < 1 || email.Text.Length < 1 || adresa.Text.Length < 1 || prezime.Text.Length < 1 || jmbg.Text.Length < 1 || telefon.Text.Length < 1)
                    {
                        toolStripStatusLabel1.Text = "Popunite sva polja";
                    }

                    else if ((IspravnaLicna(licna.Text)) && ime.Text.Length < 45 && email.Text.Length < 50 && adresa.Text.Length < 45 && provjeriJMBG(jmbg.Text) && prezime.Text.Length < 45 && IspravanIndeks(index.Text))
                    {
                        Uposlenik u = new Uposlenik(licna.Text, ime.Text, prezime.Text, adresa.Text, email.Text, telefon.Text, Convert.ToDateTime(datum.Text), jmbg.Text, tipUposlenika.Text);
                        u.Slika = (Bitmap)naslovnaStrana.Image;
                        dao.DodajUposlenika(u);

                        PrintPreviewDialog previewDialog = new PrintPreviewDialog();
                        PrintDocument pd = new PrintDocument();
                        pd.PrintPage += new PrintPageEventHandler(this.pd_Stampaj);

                        previewDialog.Document = pd;
                        previewDialog.SetBounds(50, -550, 200, 200);
                        previewDialog.ShowDialog();

                        toolStripStatusLabel1.Text = "";
                        ime.Text = prezime.Text = licna.Text = jmbg.Text = adresa.Text = email.Text = index.Text = telefon.Text= "";
                        faks.SelectedIndex = 1;
                        clanarina.SelectedIndex = 1;
                        tipUposlenika.SelectedIndex = 1;
                        naslovnaStrana.Image = ((System.Drawing.Image)(Properties.Resources.Misc_User_icon));
                        //   ));
                        toolStripStatusLabel1.Text = "Korisnik dodan";

                    }
                    else toolStripStatusLabel1.Text = "Unesite ispravne podatke, korisnik nije dodan!";

                }
                if (tabControl1.SelectedIndex == 1)
                {
                    if (ime.Text.Length < 1 || email.Text.Length < 1 || adresa.Text.Length < 1 || index.Text.Length < 1 || prezime.Text.Length < 1)
                    {
                        toolStripStatusLabel1.Text = "Popunite sva polja";
                    }
                    else if ((IspravnaLicna(licna.Text)) && ime.Text.Length < 45 && email.Text.Length < 50 && adresa.Text.Length < 45 && index.Text.Length < 11 && prezime.Text.Length < 45)
                    {
                        Student s = new Student(licna.Text, ime.Text, prezime.Text, adresa.Text, email.Text, telefon.Text, Convert.ToDateTime(datum.Text), Convert.ToInt16(index.Text), faks.Text, Convert.ToInt32(clanarina.Text));
                        s.Slika = (Bitmap)naslovnaStrana.Image;
                        dao.DodajStudenta(s);

                        if (tabControl1.SelectedIndex == 1) student = true;

                        if (tabControl2.SelectedIndex == 5)
                        {
                            Image camera = Image.FromFile("capture.png");
                            slika = new Bitmap(camera);

                        }

                        PrintPreviewDialog previewDialog = new PrintPreviewDialog();
                        PrintDocument pd = new PrintDocument();
                        pd.PrintPage += new PrintPageEventHandler(this.pd_Stampaj);

                        previewDialog.Document = pd;
                        previewDialog.SetBounds(50, -550, 200, 200);
                        previewDialog.ShowDialog();

                        ime.Text = prezime.Text = licna.Text = jmbg.Text = adresa.Text = email.Text = index.Text = telefon.Text ="";
                        faks.SelectedIndex = 1;
                        clanarina.SelectedIndex = 1;
                        tipUposlenika.SelectedIndex = 1;
                        naslovnaStrana.Image = ((System.Drawing.Image)(Properties.Resources.Misc_User_icon));
                        toolStripStatusLabel1.Text = "Korisnik dodan";
                    }

                    else toolStripStatusLabel1.Text = "Unesite ispravne podatke, korisnik nije dodan!";

                }
            }
            catch (Exception izuzetak)
            {
                MessageBox.Show(izuzetak.Message);
            }
        }
开发者ID:ik15151,项目名称:etf-2011-ooad-biblioteka,代码行数:86,代码来源:RegistracijaKorisnik.cs

示例7: PrintTokens2

        private void PrintTokens2(List<VIPPrasadam> tokens)
        {
            _tokensToPrint = tokens;
            _pageCounter = 0;

            PrintDocument pd = new PrintDocument();
            PrintDocument pd1 = new PrintDocument();

            pd.DefaultPageSettings.PaperSize = paperSize;
            pd.PrintPage += printDoc_PrintPage;
            pd.PrinterSettings.PrinterName = App.AppMainForm.GetTokenPrinter();

            //ToDo: can remove preview in the actual production.
            if (App.AppMainForm.IsPrintPreviewEnabled)
            {
                var ppDlg = new PrintPreviewDialog();
                ppDlg.SetBounds(30, 30, 1024, 500);
                ppDlg.PrintPreviewControl.AutoZoom = true;
                ppDlg.PrintPreviewControl.Zoom = 0.75;
                ppDlg.Document = pd;
                var dr = ppDlg.ShowDialog(this);
            }
            else
            {
                pd.Print();
            }
        }
开发者ID:prabhuashwin,项目名称:eTempleVinayaka,代码行数:27,代码来源:VIPPrasadamForm.cs

示例8: toolStripPrint_Click


//.........这里部分代码省略.........
                                        {
                                            pe.Graphics.FillRectangle(brush, x_pos, y_pos, pe.MarginBounds.Right - x_pos, line_height);
                                        }
                                    }

                                    using (Font font = new Font("tahoma", 8f))
                                    {
                                        using (SolidBrush brush = new SolidBrush(Color.Black))
                                        {
                                            using (Pen p = new Pen(Color.DarkGray))
                                            {
                                                pe.Graphics.DrawLine(p, x_pos, y_pos - 10, x_pos, y_pos + 20);
                                                pe.Graphics.DrawString((string)row.Cells[1].Value, font, brush, new RectangleF(x_pos, y_pos, col1 - cell_padding, line_height), str_right);
                                                x_pos += col1;

                                                pe.Graphics.DrawLine(p, x_pos, y_pos - 10, x_pos, y_pos + 20);
                                                pe.Graphics.DrawString((string)row.Cells[4].Value, font, brush, new RectangleF(x_pos, y_pos, col2, line_height), str_center);
                                                x_pos += col2;

                                                pe.Graphics.DrawLine(p, x_pos, y_pos - 10, x_pos, y_pos + 20);
                                                pe.Graphics.DrawString((string)row.Cells[5].Value, font, brush, new RectangleF(x_pos, y_pos, col3, line_height), str_center);
                                                x_pos += col3;

                                                pe.Graphics.DrawLine(p, x_pos, y_pos - 10, x_pos, y_pos + 20);
                                                pe.Graphics.DrawString((string)row.Cells[6].Value, font, brush, new RectangleF(x_pos, y_pos, col4, line_height), str_center);
                                                x_pos += col4;

                                                pe.Graphics.DrawLine(p, x_pos, y_pos - 10, x_pos, y_pos + 20);
                                                pe.Graphics.DrawString((string)row.Cells[7].Value, font, brush, new RectangleF(x_pos + cell_padding, y_pos, col5 - cell_padding, line_height), str_left);
                                                x_pos += col5;

                                                pe.Graphics.DrawLine(p, x_pos, y_pos - 10, x_pos, y_pos + 20);
                                                pe.Graphics.DrawString((string)row.Cells[8].Value, font, brush, new RectangleF(x_pos + cell_padding, y_pos, col6 - cell_padding, line_height), str_left);
                                                x_pos += col6;

                                                using (Font wingdings_font = new Font("wingdings", 8f))
                                                {
                                                    for (int c = 9; c <= 24; c++)
                                                    {
                                                        pe.Graphics.DrawLine(p, x_pos, y_pos - 10, x_pos, y_pos + 20);
                                                        if (((string)row.Cells[c].Value).Length > 0)
                                                        {
                                                            pe.Graphics.DrawString(((char)(byte)0xFC).ToString(), wingdings_font, brush, new RectangleF(x_pos, y_pos, col7, line_height), str_center);
                                                        }
                                                        x_pos += col7;
                                                    }
                                                }

                                                pe.Graphics.DrawLine(p, x_pos, y_pos - 10, x_pos, y_pos + 20);
                                                pe.Graphics.DrawString((string)row.Cells[25].Value, font, brush, new RectangleF(x_pos + cell_padding, y_pos, col23 - cell_padding, line_height), str_left);
                                                x_pos += col23;
                                                pe.Graphics.DrawLine(p, x_pos, y_pos - 10, x_pos, y_pos + 20);
                                            }
                                        }
                                    }

                                    row_num++;
                                }
                                x_pos = pe.MarginBounds.Left;
                                y_pos += line_height;
                                pe.Graphics.DrawLine(new Pen(Color.LightGray), x_pos, y_pos, pe.MarginBounds.Right, y_pos);
                            }
                        }
                    }
                    #endregion Print data row
                };

                if (print_out.output == PrintOutputSelection.OUTPUT.SCREEN)
                {
                    PrintPreviewDialog preview_dialog = new PrintPreviewDialog();
                    preview_dialog.SetBounds(this.ClientRectangle.X + 5, this.ClientRectangle.Y + 5, this.ClientRectangle.Width - 10, this.ClientRectangle.Height - 10);
                    preview_dialog.Document = print_doc;
                    preview_dialog.MdiParent = this.main_form;
                    preview_dialog.Show();
                }

                if (print_out.output == PrintOutputSelection.OUTPUT.PRINTER)
                {
                    PrintDialog print_dialog = new PrintDialog();
                    print_dialog.Document = print_doc;
                    print_dialog.AllowSelection = false;
                    print_dialog.AllowSomePages = false;
                    print_dialog.AllowPrintToFile = false;
                    print_dialog.AllowCurrentPage = false;
                    print_dialog.UseEXDialog = true;
                    if (print_dialog.ShowDialog() == DialogResult.OK)
                    {
                        print_doc.Print();
                    }
                }

                print_doc = null;
                page_setup = null;
            }
            else
            {
                print_doc = null;
                page_setup = null;
            }
        }
开发者ID:wee2tee,项目名称:SN_Net,代码行数:101,代码来源:SupportNoteWindow.cs

示例9: button2_Click

        private void button2_Click(object sender, EventArgs e)
        {
            if (tabControl1.SelectedIndex == 1) student = true;
            PrintPreviewDialog previewDialog = new PrintPreviewDialog();
            PrintDocument pd = new PrintDocument();

            pd.PrintPage += new PrintPageEventHandler(this.pd_Stampaj);

            previewDialog.Document = pd;
            previewDialog.SetBounds(50, -550, 200, 200);
            previewDialog.ShowDialog();
        }
开发者ID:ik15151,项目名称:etf-2011-ooad-biblioteka,代码行数:12,代码来源:RegistracijaKorisnik.cs

示例10: PrintTokens

        private void PrintTokens(List<Token> tokens)
        {
            _tokensToPrint = tokens;
            _pageCounter = 0;

            PrintDocument pd = new PrintDocument();
            PrintDocument pd1 = new PrintDocument();

            if (_tokensToPrint[_pageCounter].ServiceTypeID != 9)
            {
                pd.DefaultPageSettings.PaperSize = paperSize;
                pd.PrintPage += printDoc_PrintPage;
                pd.PrinterSettings.PrinterName = App.AppMainForm.GetTokenPrinter();
            }
            else
            {
                pd1.DefaultPageSettings.PaperSize = paperSize1;
                pd1.PrintPage += printDoc_PrintPage_1;
                pd1.PrinterSettings.PrinterName = App.AppMainForm.GetSlipPrinter();
            }

            //ToDo: can remove preview in the actual production.
            if (App.AppMainForm.IsPrintPreviewEnabled)
            {
                var ppDlg = new PrintPreviewDialog();
                ppDlg.SetBounds(30, 30, 1024, 500);
                ppDlg.PrintPreviewControl.AutoZoom = true;
                ppDlg.PrintPreviewControl.Zoom = 0.75;

                if (_tokensToPrint[_pageCounter].ServiceTypeID != 9)
                {
                    ppDlg.Document = pd;
                }
                else
                {
                    ppDlg.Document = pd1;
                }
                var dr = ppDlg.ShowDialog(this);
            }
            else
            {
                if (_tokensToPrint[_pageCounter].ServiceTypeID != 9)
                {
                    pd.Print();
                }
                else
                {
                    pd1.Print();
                }
            }
        }
开发者ID:prabhuashwin,项目名称:eTempleVinayaka,代码行数:51,代码来源:ReceiptsForm.cs

示例11: toolStripPrint_Click


//.........这里部分代码省略.........
                                pe.Graphics.DrawLine(p, 515, y_pos - 12, 515, y_pos + 15);
                                pe.Graphics.DrawLine(p, 540, y_pos - 12, 540, y_pos + 15);
                                pe.Graphics.DrawLine(p, 565, y_pos - 12, 565, y_pos + 15);
                                pe.Graphics.DrawLine(p, 590, y_pos - 12, 590, y_pos + 15);
                                pe.Graphics.DrawLine(p, 615, y_pos - 12, 615, y_pos + 15);
                                pe.Graphics.DrawLine(p, 640, y_pos - 12, 640, y_pos + 15);
                                pe.Graphics.DrawLine(p, 665, y_pos - 12, 665, y_pos + 15);
                                pe.Graphics.DrawLine(p, 690, y_pos - 12, 690, y_pos + 15);
                                pe.Graphics.DrawLine(p, 715, y_pos - 12, 715, y_pos + 15);
                                pe.Graphics.DrawLine(p, 740, y_pos - 12, 740, y_pos + 15);
                                pe.Graphics.DrawLine(p, 765, y_pos - 12, 765, y_pos + 15);
                                pe.Graphics.DrawLine(p, 790, y_pos - 12, 790, y_pos + 15);
                                pe.Graphics.DrawLine(p, 815, y_pos - 12, 815, y_pos + 15);
                                pe.Graphics.DrawLine(p, 840, y_pos - 12, 840, y_pos + 15);
                                // draw double horizontal line
                                pe.Graphics.DrawLine(p, 440, y_pos + 13, 840, y_pos + 13);
                                pe.Graphics.DrawLine(p, 440, y_pos + 15, 840, y_pos + 15);

                                pe.Graphics.DrawString("รวม", font, brush, new RectangleF(350, y_pos, 80, 15), str_format_right);
                                pe.Graphics.DrawString(this.note_list.Where(n => n.map_drive.Length > 0).Count<Note>().ToString(), font, brush, new RectangleF(440, y_pos, 25, 15), str_format_right);
                                pe.Graphics.DrawString(this.note_list.Where(n => n.install.Length > 0).Count<Note>().ToString(), font, brush, new RectangleF(465, y_pos, 25, 15), str_format_right);
                                pe.Graphics.DrawString(this.note_list.Where(n => n.error.Length > 0).Count<Note>().ToString(), font, brush, new RectangleF(490, y_pos, 25, 15), str_format_right);
                                pe.Graphics.DrawString(this.note_list.Where(n => n.fonts.Length > 0).Count<Note>().ToString(), font, brush, new RectangleF(515, y_pos, 25, 15), str_format_right);
                                pe.Graphics.DrawString(this.note_list.Where(n => n.print.Length > 0).Count<Note>().ToString(), font, brush, new RectangleF(540, y_pos, 25, 15), str_format_right);
                                pe.Graphics.DrawString(this.note_list.Where(n => n.training.Length > 0).Count<Note>().ToString(), font, brush, new RectangleF(565, y_pos, 25, 15), str_format_right);
                                pe.Graphics.DrawString(this.note_list.Where(n => n.stock.Length > 0).Count<Note>().ToString(), font, brush, new RectangleF(590, y_pos, 25, 15), str_format_right);
                                pe.Graphics.DrawString(this.note_list.Where(n => n.form.Length > 0).Count<Note>().ToString(), font, brush, new RectangleF(615, y_pos, 25, 15), str_format_right);
                                pe.Graphics.DrawString(this.note_list.Where(n => n.rep_excel.Length > 0).Count<Note>().ToString(), font, brush, new RectangleF(640, y_pos, 25, 15), str_format_right);
                                pe.Graphics.DrawString(this.note_list.Where(n => n.statement.Length > 0).Count<Note>().ToString(), font, brush, new RectangleF(665, y_pos, 25, 15), str_format_right);
                                pe.Graphics.DrawString(this.note_list.Where(n => n.asset.Length > 0).Count<Note>().ToString(), font, brush, new RectangleF(690, y_pos, 25, 15), str_format_right);
                                pe.Graphics.DrawString(this.note_list.Where(n => n.secure.Length > 0).Count<Note>().ToString(), font, brush, new RectangleF(715, y_pos, 25, 15), str_format_right);
                                pe.Graphics.DrawString(this.note_list.Where(n => n.year_end.Length > 0).Count<Note>().ToString(), font, brush, new RectangleF(740, y_pos, 25, 15), str_format_right);
                                pe.Graphics.DrawString(this.note_list.Where(n => n.period.Length > 0).Count<Note>().ToString(), font, brush, new RectangleF(765, y_pos, 25, 15), str_format_right);
                                pe.Graphics.DrawString(this.note_list.Where(n => n.mail_wait.Length > 0).Count<Note>().ToString(), font, brush, new RectangleF(790, y_pos, 25, 15), str_format_right);
                                pe.Graphics.DrawString(this.note_list.Where(n => n.transfer_mkt.Length > 0).Count<Note>().ToString(), font, brush, new RectangleF(815, y_pos, 25, 15), str_format_right);
                                #endregion draw summary data

                                y_pos += 20;
                                if (y_pos > pe.MarginBounds.Bottom)
                                {
                                    pe.HasMorePages = true;
                                    return;
                                }
                                else
                                {
                                    pe.HasMorePages = false;
                                }
                                pe.Graphics.DrawString("(เวลารับสาย : " + this.lblWorkTime.Text + ") + (เวลาพักสาย : " + this.lblBreakTime.Text + ") = (เวลารวม : " + this.lblTotalTime.Text + ")" , font, brush, new Rectangle(10, y_pos, 800, 15));

                                y_pos += 20;
                                if (y_pos > pe.MarginBounds.Bottom)
                                {
                                    pe.HasMorePages = true;
                                    return;
                                }
                                else
                                {
                                    pe.HasMorePages = false;
                                }
                                pe.Graphics.DrawString("จำนวนวันลา/ออกพบลูกค้า : " + this.lblPeriodAbsent.Text, font, brush, new Rectangle(10, y_pos, 400, 15));
                            }
                        }
                    }
                };

                if (wind.output == PrintOutputSelection.OUTPUT.PRINTER)
                {
                    PrintDialog print_dialog = new PrintDialog();
                    print_dialog.Document = print_doc;
                    print_dialog.AllowSelection = false;
                    print_dialog.AllowSomePages = true;
                    print_dialog.AllowPrintToFile = false;
                    print_dialog.AllowCurrentPage = false;
                    print_dialog.UseEXDialog = true;
                    if (print_dialog.ShowDialog() == DialogResult.OK)
                    {
                        print_doc.Print();
                    }
                }

                if (wind.output == PrintOutputSelection.OUTPUT.SCREEN)
                {
                    PrintPreviewDialog preview_dialog = new PrintPreviewDialog();
                    preview_dialog.SetBounds(this.ClientRectangle.X + 5, this.ClientRectangle.Y + 5, this.ClientRectangle.Width - 10, this.ClientRectangle.Height - 10);
                    preview_dialog.Document = print_doc;
                    preview_dialog.MdiParent = this.main_form;
                    preview_dialog.Show();
                }

                if (wind.output == PrintOutputSelection.OUTPUT.FILE)
                {

                }
            }
            else
            {
                print_doc = null;
                page_setup = null;
            }
        }
开发者ID:wee2tee,项目名称:SN_Net,代码行数:101,代码来源:SupportStatWindow.cs

示例12: toolStripPrintSummary_Click


//.........这里部分代码省略.........
                                        }

                                        y_pos += 7;
                                        is_new_page = false;
                                    }
                                    #endregion draw column header

                                    #region draw row data
                                    pe.Graphics.DrawLine(p, x_pos, y_pos - 6, x_pos, y_pos + 15);
                                    using (SolidBrush brush_gray = new SolidBrush(Color.Gray))
                                    {
                                        pe.Graphics.DrawString((i + 1).ToString(), font, brush_gray, new Rectangle(x_pos, y_pos, col0_width - 5, 13), str_format_right);
                                    }
                                    x_pos += col0_width;
                                    pe.Graphics.DrawLine(p, x_pos, y_pos - 6, x_pos, y_pos + 15); // column separator

                                    using (Font font_bold = new Font("tahoma", 8f, FontStyle.Bold))
                                    {
                                        pe.Graphics.DrawString(supports[i].username, font_bold, brush, new Rectangle(x_pos + 5, y_pos, col1_width - 5, 13), str_format_left);
                                    }
                                    x_pos += col1_width;
                                    pe.Graphics.DrawLine(p, x_pos, y_pos - 6, x_pos, y_pos + 15);  // column separator

                                    pe.Graphics.DrawString(supports[i].name, font, brush, new Rectangle(x_pos + 5, y_pos, col2_width - 5, 13), str_format_left);
                                    x_pos += col2_width;
                                    pe.Graphics.DrawLine(p, x_pos, y_pos - 6, x_pos, y_pos + 15);  // column separator

                                    pe.Graphics.DrawString(note_list.Where(n => n.users_name == supports[i].username && n.is_break != "Y").Count<Note>().ToString(), font, brush, new Rectangle(x_pos, y_pos, col3_width - 5, 13), str_format_right);
                                    x_pos += col3_width;
                                    pe.Graphics.DrawLine(p, x_pos, y_pos - 6, x_pos, y_pos + 15);  // column separator

                                    string talk_time = (note_list.Where(n => n.users_name == supports[i].username && n.is_break != "Y").Count<Note>() > 0 ? Math.Ceiling(note_list.Where(n => n.users_name == supports[i].username).ToList<Note>().GetSummaryTalkTime().TotalMinutes).ToString() + " นาที" : "-");
                                    pe.Graphics.DrawString(talk_time, font, brush, new Rectangle(x_pos, y_pos, col4_width, 13), str_format_center);
                                    x_pos += col4_width;
                                    pe.Graphics.DrawLine(p, x_pos, y_pos - 6, x_pos, y_pos + 15);  // column separator

                                    double min_per_line = Math.Floor(Math.Floor(note_list.Where(n => n.users_name == supports[i].username).ToList<Note>().GetSummaryTalkTime().TotalMinutes) / note_list.Where(n => n.users_name == supports[i].username && n.is_break != "Y").Count<Note>());
                                    double sec_per_line = Math.Floor((Math.Floor(note_list.Where(n => n.users_name == supports[i].username).ToList<Note>().GetSummaryTalkTime().TotalSeconds) - (min_per_line * note_list.Where(n => n.users_name == supports[i].username && n.is_break != "Y").Count<Note>() * 60)) / note_list.Where(n => n.users_name == supports[i].username && n.is_break != "Y").Count<Note>());
                                    string time_per_line = (note_list.Where(n => n.users_name == supports[i].username && n.is_break != "Y").Count<Note>() > 0 ? min_per_line.ToString() + " นาที " + sec_per_line.ToString() + " วินาที / 1 สาย" : "-");
                                    pe.Graphics.DrawString(time_per_line, font, brush, new Rectangle(x_pos, y_pos, col5_width, 13), str_format_center);
                                    x_pos += col5_width;
                                    pe.Graphics.DrawLine(p, x_pos, y_pos - 6, x_pos, y_pos + 15);  // column separator

                                    string break_time = (note_list.Where(n => n.users_name == supports[i].username && n.is_break != "Y").Count<Note>() > 0 ? Math.Ceiling(note_list.Where(n => n.users_name == supports[i].username).ToList<Note>().GetSummaryBreakTime().TotalMinutes).ToString() + " นาที" : "-");
                                    pe.Graphics.DrawString(break_time, font, brush, new Rectangle(x_pos, y_pos, col6_width, 13), str_format_center);
                                    x_pos += col6_width;
                                    pe.Graphics.DrawLine(p, x_pos, y_pos - 6, x_pos, y_pos + 15);  // column separator

                                    pe.Graphics.DrawString(this.event_calendar.Where(c => c.users_name == supports[i].username).ToList<EventCalendar>().GetSummaryHoursMinutesString(), font, brush, new Rectangle(x_pos, y_pos, col7_width, 13), str_format_center);
                                    x_pos += col7_width;
                                    pe.Graphics.DrawLine(p, x_pos, y_pos - 6, x_pos, y_pos + 15);  // column separator

                                    // Horizontal line
                                    x_pos = 10;
                                    pe.Graphics.DrawLine(p, x_pos, y_pos + 15, x_pos + 790, y_pos + 15);
                                    #endregion draw row data

                                    row_num++;
                                    y_pos += 20;
                                }
                            }
                        }
                    }
                };

                if (wind.output == PrintOutputSelection.OUTPUT.PRINTER)
                {
                    PrintDialog print_dialog = new PrintDialog();
                    print_dialog.Document = print_doc;
                    print_dialog.AllowSelection = false;
                    print_dialog.AllowSomePages = true;
                    print_dialog.AllowPrintToFile = false;
                    print_dialog.AllowCurrentPage = false;
                    print_dialog.UseEXDialog = true;
                    if (print_dialog.ShowDialog() == DialogResult.OK)
                    {
                        print_doc.Print();
                    }
                }

                if (wind.output == PrintOutputSelection.OUTPUT.SCREEN)
                {
                    PrintPreviewDialog preview_dialog = new PrintPreviewDialog();
                    preview_dialog.SetBounds(this.ClientRectangle.X + 5, this.ClientRectangle.Y + 5, this.ClientRectangle.Width - 10, this.ClientRectangle.Height - 10);
                    preview_dialog.Document = print_doc;
                    preview_dialog.MdiParent = this.main_form;
                    preview_dialog.Show();
                }

                if (wind.output == PrintOutputSelection.OUTPUT.FILE)
                {

                }
            }
            else
            {
                print_doc = null;
                page_setup = null;
            }
        }
开发者ID:wee2tee,项目名称:SN_Net,代码行数:101,代码来源:SupportStatWindow.cs

示例13: toolStripPrint_Click


//.........这里部分代码省略.........
                                    row_num++;
                                    y_pos += 25;
                                }

                                if (y_pos > pe.MarginBounds.Bottom)
                                {
                                    pe.HasMorePages = true;
                                    return;
                                }
                                else
                                {
                                    pe.HasMorePages = false;
                                }
                                pe.Graphics.DrawString(this.toolStripInfo.Text, font, brush, new Rectangle(10, y_pos, 400, 15));

                                y_pos += 10;
                                if (y_pos > pe.MarginBounds.Bottom)
                                {
                                    pe.HasMorePages = true;
                                    return;
                                }
                                else
                                {
                                    pe.HasMorePages = false;
                                }
                                using (Font bold_font = new Font("tahoma", 8f, FontStyle.Bold))
                                {
                                    pe.Graphics.DrawString(this.groupPeriod.Text.Trim(), bold_font, brush, new Rectangle(10, y_pos, 400, 15));
                                    pe.Graphics.DrawString(this.groupTotal.Text.Trim(), bold_font, brush, new Rectangle(420, y_pos, 400, 15));
                                }

                                y_pos += 20;
                                if (y_pos > pe.MarginBounds.Bottom)
                                {
                                    pe.HasMorePages = true;
                                    return;
                                }
                                else
                                {
                                    pe.HasMorePages = false;
                                }
                                pe.Graphics.DrawString("ลางาน", font, brush, new Rectangle(10, y_pos, 80, 15));
                                pe.Graphics.DrawString(" : " + this.lblPeriodAbsent.Text, font, brush, new Rectangle(90, y_pos, 320, 15));
                                pe.Graphics.DrawString("ลางาน", font, brush, new Rectangle(420, y_pos, 80, 15));
                                pe.Graphics.DrawString(" : " + this.lblTotalAbsent.Text, font, brush, new Rectangle(500, y_pos, 320, 15));

                                y_pos += 20;
                                if (y_pos > pe.MarginBounds.Bottom)
                                {
                                    pe.HasMorePages = true;
                                    return;
                                }
                                else
                                {
                                    pe.HasMorePages = false;
                                }
                                pe.Graphics.DrawString("ออกพบลูกค้า", font, brush, new Rectangle(10, y_pos, 80, 15));
                                pe.Graphics.DrawString(" : " + this.lblPeriodServ.Text, font, brush, new Rectangle(90, y_pos, 320, 15));
                                pe.Graphics.DrawString("ออกพบลูกค้า", font, brush, new Rectangle(420, y_pos, 80, 15));
                                pe.Graphics.DrawString(" : " + this.lblTotalServ.Text, font, brush, new Rectangle(500, y_pos, 320, 15));
                            }
                        }
                    }
                };

                if (wind.output == PrintOutputSelection.OUTPUT.PRINTER)
                {
                    PrintDialog print_dialog = new PrintDialog();
                    print_dialog.Document = print_doc;
                    print_dialog.AllowSelection = false;
                    print_dialog.AllowSomePages = true;
                    print_dialog.AllowPrintToFile = false;
                    print_dialog.AllowCurrentPage = false;
                    print_dialog.UseEXDialog = true;
                    if (print_dialog.ShowDialog() == DialogResult.OK)
                    {
                        print_doc.Print();
                    }
                }

                if (wind.output == PrintOutputSelection.OUTPUT.SCREEN)
                {
                    PrintPreviewDialog preview_dialog = new PrintPreviewDialog();
                    preview_dialog.SetBounds(this.ClientRectangle.X + 5, this.ClientRectangle.Y + 5, this.ClientRectangle.Width - 10, this.ClientRectangle.Height - 10);
                    preview_dialog.Document = print_doc;
                    preview_dialog.MdiParent = this.main_form;
                    preview_dialog.Show();
                }

                if (wind.output == PrintOutputSelection.OUTPUT.FILE)
                {

                }
            }
            else
            {
                print_doc = null;
                page_setup = null;
            }
        }
开发者ID:wee2tee,项目名称:SN_Net,代码行数:101,代码来源:LeaveWindow.cs

示例14: toolStripPrintSummary_Click


//.........这里部分代码省略.........
                                            pe.Graphics.DrawLine(pen_darkgray, x_pos, y_pos, x_pos + 790, y_pos); // horizontal line below
                                        }

                                        y_pos += 7;
                                        is_new_page = false;
                                    }
                                    #endregion draw column header

                                    #region draw row data
                                    pe.Graphics.DrawLine(p, x_pos, y_pos - 6, x_pos, y_pos + 20); // column separator

                                    using (SolidBrush brush_gray = new SolidBrush(Color.Gray))
                                    {
                                        pe.Graphics.DrawString((row_num + 1).ToString(), font, brush_gray, new Rectangle(x_pos, y_pos, col0_width - 5, 18), str_format_right);
                                        x_pos += col0_width;
                                        pe.Graphics.DrawLine(p, x_pos, y_pos - 6, x_pos, y_pos + 20); // column separator
                                    }

                                    using (Font font_bold = new Font("tahoma", 8f, FontStyle.Bold))
                                    {
                                        pe.Graphics.DrawString(this.users_list[i].username, font_bold, brush, new Rectangle(x_pos + 5, y_pos, col1_width - 5, 18), str_format_left);
                                        x_pos += col1_width;
                                        pe.Graphics.DrawLine(p, x_pos, y_pos - 6, x_pos, y_pos + 20); // column separator
                                    }

                                    pe.Graphics.DrawString(this.users_list[i].name, font, brush, new Rectangle(x_pos + 5, y_pos, col2_width - 5, 18), str_format_left);
                                    x_pos += col2_width;
                                    pe.Graphics.DrawLine(p, x_pos, y_pos - 6, x_pos, y_pos + 20); // column separator

                                    //using (SolidBrush brush_gray = new SolidBrush(Color.Gray))
                                    //{
                                        pe.Graphics.DrawString(this.sorted_list.Where(s => s.users_name == this.users_list[i].username).Where(s => s.event_type == EventCalendar.EVENT_TYPE_ABSENT_CAUSE).ToList<EventCalendar>().GetSummaryLeaveDayString(), font, brush, new Rectangle(x_pos, y_pos, col3_width, 18), str_format_center);
                                        x_pos += col3_width;
                                        pe.Graphics.DrawLine(p, x_pos, y_pos - 6, x_pos, y_pos + 20);  // column separator
                                    //}

                                    using (Font font_bold = new Font("tahoma", 8f, FontStyle.Bold))
                                    {
                                        pe.Graphics.DrawString(this.sorted_list.Where(s => s.users_name == this.users_list[i].username).Where(s => s.event_type == EventCalendar.EVENT_TYPE_ABSENT_CAUSE).ToList<EventCalendar>().GetSummaryLeaveDayStringForCommission(), font_bold, brush, new Rectangle(x_pos, y_pos, col4_width, 18), str_format_center);
                                        x_pos += col4_width;
                                        pe.Graphics.DrawLine(p, x_pos, y_pos - 6, x_pos, y_pos + 20);  // column separator
                                    }

                                    string fine = (this.sorted_list.Where(s => s.users_name == this.users_list[i].username).Where(s => s.event_type == EventCalendar.EVENT_TYPE_ABSENT_CAUSE).ToList<EventCalendar>().GetSummaryFine() == 0 ? "" : this.sorted_list.Where(s => s.users_name == this.users_list[i].username).Where(s => s.event_type == EventCalendar.EVENT_TYPE_ABSENT_CAUSE).ToList<EventCalendar>().GetSummaryFine().ToString());
                                    pe.Graphics.DrawString(fine, font, brush, new Rectangle(x_pos, y_pos, col5_width - 5, 18), str_format_right);
                                    x_pos += col5_width;
                                    pe.Graphics.DrawLine(p, x_pos, y_pos - 6, x_pos, y_pos + 20);  // column separator

                                    pe.Graphics.DrawString(this.sorted_list.Where(s => s.users_name == this.users_list[i].username).Where(s => s.event_type == EventCalendar.EVENT_TYPE_ABSENT_CAUSE).ToList<EventCalendar>().GetSummaryMedCertRemark(), font, brush, new Rectangle(x_pos + 5, y_pos, col6_width - 5, 18), str_format_left);
                                    x_pos += col6_width;
                                    pe.Graphics.DrawLine(p, x_pos, y_pos - 6, x_pos, y_pos + 20);  // column separator

                                    // Horizontal line
                                    x_pos = 10;
                                    pe.Graphics.DrawLine(p, x_pos, y_pos + 20, x_pos + 790, y_pos + 20);
                                    #endregion draw row data

                                    row_num++;
                                    y_pos += 25;
                                }
                            }
                        }
                    }
                };

                if (wind.output == PrintOutputSelection.OUTPUT.PRINTER)
                {
                    PrintDialog print_dialog = new PrintDialog();
                    print_dialog.Document = print_doc;
                    print_dialog.AllowSelection = false;
                    print_dialog.AllowSomePages = true;
                    print_dialog.AllowPrintToFile = false;
                    print_dialog.AllowCurrentPage = false;
                    print_dialog.UseEXDialog = true;
                    if (print_dialog.ShowDialog() == DialogResult.OK)
                    {
                        print_doc.Print();
                    }
                }

                if (wind.output == PrintOutputSelection.OUTPUT.SCREEN)
                {
                    PrintPreviewDialog preview_dialog = new PrintPreviewDialog();
                    preview_dialog.SetBounds(this.ClientRectangle.X + 5, this.ClientRectangle.Y + 5, this.ClientRectangle.Width - 10, this.ClientRectangle.Height - 10);
                    preview_dialog.Document = print_doc;
                    preview_dialog.MdiParent = this.main_form;
                    preview_dialog.Show();
                }

                if (wind.output == PrintOutputSelection.OUTPUT.FILE)
                {

                }
            }
            else
            {
                print_doc = null;
                page_setup = null;
            }
        }
开发者ID:wee2tee,项目名称:SN_Net,代码行数:101,代码来源:LeaveWindow.cs


注:本文中的System.Windows.Forms.PrintPreviewDialog.SetBounds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。