private void PrintButton_Click(object sender, EventArgs e)
        {
            foreach (TabPage curPage in ReportTabControl.TabPages)
            {
                curPage.Select();
                curPage.Focus();
                curPage.Show();
            }
            ReportTabControl.TabPages[0].Select();
            ReportTabControl.TabPages[0].Focus();
            ReportTabControl.TabPages[0].Show();

            FormReportPrinter curFormPrint = new FormReportPrinter(ReportTabControl);

            curFormPrint.ReportHeader          = "Tow Boat Use and Performance Document" + sanctionIdTextBox.Text + " - " + nameTextBox.Text;
            curFormPrint.CenterHeaderOnPage    = true;
            curFormPrint.ReportHeaderFont      = new Font("Arial", 12, FontStyle.Bold, GraphicsUnit.Point);
            curFormPrint.ReportHeaderTextColor = Color.Black;

            curFormPrint.BottomMargin = 75;
            curFormPrint.TopMargin    = 50;
            curFormPrint.LeftMargin   = 50;
            curFormPrint.RightMargin  = 50;

            curFormPrint.Print();
        }
Ejemplo n.º 2
0
        public void PrintButton_Click(object sender, EventArgs e)
        {
            int curPageNum = 0;
            FormReportPrinter curFormPrint = new FormReportPrinter(ReportTabControl);

            curFormPrint.ReportHeader = "Tow Boat Use and Performance Document" + sanctionIdTextBox.Text + " - " + nameTextBox.Text;
            curFormPrint.ReportName   = sanctionIdTextBox.Text + "TU";

            curFormPrint.CenterHeaderOnPage    = true;
            curFormPrint.ReportHeaderFont      = new Font("Arial", 12, FontStyle.Bold, GraphicsUnit.Point);
            curFormPrint.ReportHeaderTextColor = Color.Black;

            curFormPrint.BottomMargin = 40;
            curFormPrint.TopMargin    = 50;
            curFormPrint.LeftMargin   = 50;
            curFormPrint.RightMargin  = 50;

            if (myBoatUseDataTable.Rows.Count > 0)
            {
                for (myBoatRowIdx = 0; myBoatRowIdx < myBoatUseDataTable.Rows.Count; myBoatRowIdx += 5)
                {
                    TowboatUseLoad(myBoatRowIdx);

                    foreach (TabPage curPage in ReportTabControl.TabPages)
                    {
                        curPage.Select();
                        curPage.Focus();
                        curPage.Show();
                    }
                    ReportTabControl.TabPages[0].Select();
                    ReportTabControl.TabPages[0].Focus();
                    ReportTabControl.TabPages[0].Show();

                    if (myBoatRowIdx > 0)
                    {
                        curPageNum = (myBoatRowIdx / 5) + 1;
                        curFormPrint.ReportName = sanctionIdTextBox.Text + "TU-P" + curPageNum.ToString();
                    }
                    curFormPrint.Print(false);
                }
            }
            else
            {
                ReportTabControl.TabPages[0].Select();
                ReportTabControl.TabPages[0].Focus();
                ReportTabControl.TabPages[0].Show();
                curFormPrint.Print();
            }
        }