コード例 #1
0
        private void pd_PrintPage(object sender, PrintPageEventArgs e)
        {
            Rectangle bounds = e.MarginBounds;
            Graphics  g      = e.Graphics;
            string    text;
            Font      headingFont    = new Font("Arial", 13, FontStyle.Bold);
            Font      subHeadingFont = new Font("Arial", 10, FontStyle.Bold);
            int       yPos           = bounds.Top;
            int       center         = bounds.X + bounds.Width / 2;

            #region printHeading
            if (!_headingPrinted)
            {
                text = Lan.g(this, "Incomplete Procedure Notes");
                g.DrawString(text, headingFont, Brushes.Black, center - g.MeasureString(text, headingFont).Width / 2, yPos);
                yPos += (int)g.MeasureString(text, headingFont).Height;
                text  = PrefC.GetString(PrefName.PracticeTitle);
                g.DrawString(text, subHeadingFont, Brushes.Black, center - g.MeasureString(text, subHeadingFont).Width / 2, yPos);
                yPos += (int)g.MeasureString(text, headingFont).Height;
                if (_listSelectedProvNums.Count == 0 || _listSelectedProvNums.Count == comboBoxMultiProv.Items.Count - 1)
                {
                    text = Lan.g(this, "All Providers");
                }
                else
                {
                    text = Lan.g(this, "For Providers:") + " " + string.Join(",", _listSelectedProvNums.Select(provNum => Providers.GetAbbr(provNum)));
                }
                g.DrawString(text, subHeadingFont, Brushes.Black, center - g.MeasureString(text, subHeadingFont).Width / 2, yPos);
                yPos += (int)g.MeasureString(text, headingFont).Height;
                if (comboBoxMultiClinics.ListSelectedClinicNums.Count == 0 || comboBoxMultiClinics.IsAllSelected)               //No clinics selected or 'All' selected
                {
                    text = Lan.g(this, "All Clinics");
                }
                else
                {
                    text = Lan.g(this, "For Clinics:") + " " + string.Join(",", comboBoxMultiClinics.ListSelectedClinics.Select(clinic => clinic.Abbr));
                }
                g.DrawString(text, subHeadingFont, Brushes.Black, center - g.MeasureString(text, subHeadingFont).Width / 2, yPos);
                yPos           += 20;
                _headingPrinted = true;
                _headingPrintH  = yPos;
            }
            #endregion
            yPos = gridMain.PrintPage(g, _pagesPrinted, bounds, _headingPrintH);
            _pagesPrinted++;
            if (yPos == -1)
            {
                e.HasMorePages = true;
            }
            else
            {
                e.HasMorePages = false;
            }
            g.Dispose();
        }
コード例 #2
0
        private void pd_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            Rectangle bounds = e.MarginBounds;
            //new Rectangle(50,40,800,1035);//Some printers can handle up to 1042
            Graphics g = e.Graphics;
            string   text;
            Font     headingFont    = new Font("Arial", 13, FontStyle.Bold);
            Font     subHeadingFont = new Font("Arial", 10, FontStyle.Bold);
            int      yPos           = bounds.Top;
            int      center         = bounds.X + bounds.Width / 2;

            #region printHeading
            if (!headingPrinted)
            {
                text = Lan.g(this, "Treatment Finder");
                g.DrawString(text, headingFont, Brushes.Black, center - g.MeasureString(text, headingFont).Width / 2, yPos);
                yPos += (int)g.MeasureString(text, headingFont).Height;
                if (checkIncludeNoIns.Checked)
                {
                    text = "Include patients without insurance";
                }
                else
                {
                    text = "Only patients with insurance";
                }
                g.DrawString(text, subHeadingFont, Brushes.Black, center - g.MeasureString(text, subHeadingFont).Width / 2, yPos);
                yPos          += 20;
                headingPrinted = true;
                headingPrintH  = yPos;
            }
            #endregion
            yPos = gridMain.PrintPage(g, pagesPrinted, bounds, headingPrintH);
            pagesPrinted++;
            if (yPos == -1)
            {
                e.HasMorePages = true;
            }
            else
            {
                e.HasMorePages = false;
            }
            g.Dispose();
        }