Ignore:
Timestamp:
Apr 4, 2011, 6:11:50 AM (13 years ago)
Author:
Sam Habiel
Message:

CGDocumentManager: Localization now works from CurrentCulture, not just CurrentUICulture.
CGView: Nothing important. Designer moves around stuff; again.
Printing: Routing slip arabized; page starts at a lower level to allow for a watermark. Graphics.Dispose now called at the end of all prints to allow for faster gc.
strings: Updated with more translations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/Printing.cs

    r1126 r1131  
    136136                apptPrinting++;
    137137            }
     138
     139
     140            g.Dispose();
    138141        }
    139142
     
    164167            };
    165168
     169            string s;
    166170
    167171            // A few fonts
     
    170174            Font fGroupTitle = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);
    171175
    172             StringFormat sf0 = new StringFormat()
     176            StringFormat sfCenterCenter = new StringFormat()
    173177            {
    174178                 Alignment = StringAlignment.Center,
     
    178182            // Draw Header
    179183            string division = CGDocumentManager.Current.ConnectInfo.DivisionName;
    180             g.DrawString(division, fBody, Brushes.Black, headerArea, sf0);
    181            
     184            g.DrawString(division, fBody, Brushes.Black, headerArea, sfCenterCenter);
     185
     186            const int watermarkLength = 75;
     187
     188            // Move down for optional form paper
     189            printArea.Y += watermarkLength;
     190            printArea.Height -= watermarkLength;
     191
    182192            // Draw Title
    183             StringFormat sf = new StringFormat();
    184             sf.Alignment = StringAlignment.Center; //for title & header
     193            StringFormat sfCenter = new StringFormat();
     194            sfCenter.Alignment = StringAlignment.Center; //for title & header
    185195
    186196            //string s = "Appointment Reminder Slip";
    187             string s = strings.ApptReminderSlip;
    188             g.DrawString(s, fTitle, Brushes.Black, printArea, sf); //title
     197            s = strings.ApptReminderSlip;
     198            g.DrawString(s, fTitle, Brushes.Black, printArea, sfCenter); //title
    189199
    190200            // move down
     
    270280            // Draw new Title
    271281            s = strings.ClinicInstructions;
    272             g.DrawString(s, fTitle, Brushes.Black, printArea, sf); //title
     282            g.DrawString(s, fTitle, Brushes.Black, printArea, sfCenter); //title
    273283
    274284            // move down
     
    303313
    304314            s = strings.Notes;
    305             g.DrawString(s, fTitle, Brushes.Black, printArea, sf); // Notes title
     315            g.DrawString(s, fTitle, Brushes.Black, printArea, sfCenter); // Notes title
    306316           
    307317            // move down
     
    324334            s = strings.Printed + ": " + DateTime.Now.ToString();
    325335            Font fFooter = new Font(FontFamily.GenericSerif, 7);
    326             g.DrawString(s, fFooter, Brushes.Black, footerArea, sf0);
    327 
     336            g.DrawString(s, fFooter, Brushes.Black, footerArea, sfCenterCenter);
     337
     338            g.Dispose();
    328339        }
    329340
     
    404415            address.AppendLine(ptRow.CITY + ", " + ptRow.STATE + " " + ptRow.ZIP);
    405416            g.DrawString(address.ToString(), fBody, Brushes.Black, printArea, sf);
     417
     418            g.Dispose();
    406419        }
    407420       
     
    460473            address.AppendLine(ptRow.CITY + ", " + ptRow.STATE + " " + ptRow.ZIP);
    461474            g.DrawString(address.ToString(), fBody, Brushes.Black, printArea, sf);
     475
     476            g.Dispose();
    462477        }
    463478
     
    518533            g.DrawString(address.ToString(), fBody, Brushes.Black, printArea, sf);
    519534
     535            g.Dispose();
    520536        }
    521537
     
    530546            e.Graphics.DrawString(msg, new Font(FontFamily.GenericSerif, 14),
    531547                Brushes.Black, e.MarginBounds);
     548            e.Graphics.Dispose();
    532549        }
    533550
     
    577594            g.DrawString(division, fBody, Brushes.Black, headerArea, sf0);
    578595
     596            const int watermarkLength = 75;
     597
     598            // Move down for optional form paper
     599            printArea.Y += watermarkLength;
     600            printArea.Height -= watermarkLength;
     601
    579602            // Draw Title
    580603            StringFormat sf = new StringFormat();
    581604            sf.Alignment = StringAlignment.Center; //for title & header
    582             string title = "Routing Slip";
     605            string title = strings.RoutingSlip;
    583606            g.DrawString(title, fTitle, Brushes.Black, printArea, sf); //title
    584607
     
    601624
    602625            // group header
    603             g.DrawString("Patient Information", fGroupTitle, Brushes.Black, new Point(personalInfoRectangle.X, personalInfoRectangle.Y - 20));
     626            s = strings.PtInfo;
     627            StringFormat sf3 = new StringFormat(System.Threading.Thread.CurrentThread.CurrentUICulture.TextInfo.IsRightToLeft ? StringFormatFlags.DirectionRightToLeft : 0);
     628            g.DrawString(s, fGroupTitle, Brushes.Black, new Rectangle(personalInfoRectangle.X, personalInfoRectangle.Y - 20, personalInfoRectangle.Width, 20), sf3);
     629
     630            StringFormat sf4 = new StringFormat(System.Threading.Thread.CurrentThread.CurrentUICulture.TextInfo.IsRightToLeft ? StringFormatFlags.DirectionRightToLeft : 0);
     631            sf4.SetTabStops(0, new float[] { 75 });
     632            sf4.SetDigitSubstitution(System.Threading.Thread.CurrentThread.CurrentUICulture.LCID, StringDigitSubstitute.Traditional);
    604633
    605634            // inner rectangle for drawing strings:
     
    608637            // Strings to write
    609638            StringBuilder sb = new StringBuilder(500);
    610             sb.AppendLine("Name:" + "\t" + appt.Patient.Name);
    611             sb.AppendLine();
    612             sb.AppendLine("ID#:" + "\t" + appt.Patient.ID);
    613             sb.AppendLine();
    614             sb.AppendLine("DOB:" + "\t" + appt.Patient.DOB.ToShortDateString());
    615             sb.AppendLine();
    616             sb.AppendLine("Age:" + "\t" + appt.Patient.UserFriendlyAge);
     639            sb.AppendLine(strings.Name + ":" + "\t" + appt.Patient.Name);
     640            sb.AppendLine();
     641            sb.AppendLine(strings.ID + ":" + "\t" + appt.Patient.ID);
     642            sb.AppendLine();
     643            sb.AppendLine(strings.DOB + ":" + "\t" + appt.Patient.DOB.ToShortDateString());
     644            sb.AppendLine();
     645            sb.AppendLine(strings.Age + ":" + "\t" + appt.Patient.UserFriendlyAge);
    617646            //sb.AppendLine();
    618647            //sb.AppendLine("Sex:" + "\t" + appt.Patient.Sex.ToString());
    619648
    620649            // Draw them
    621             g.DrawString(sb.ToString(), fBody, Brushes.Black, personalInfoInnerRectangle);
     650            g.DrawString(sb.ToString(), fBody, Brushes.Black, personalInfoInnerRectangle, sf4);
    622651
    623652            // draw curved rectangle
     
    629658
    630659            // group header
    631             g.DrawString("Appointment Information", fGroupTitle, Brushes.Black, new Point(apptInfoRectangle.X, apptInfoRectangle.Y - 20));
     660            s = strings.ApptInfo;
     661            g.DrawString(s, fGroupTitle, Brushes.Black, new Rectangle(apptInfoRectangle.X, apptInfoRectangle.Y - 20, apptInfoRectangle.Width, 20), sf3);
    632662
    633663            // Strings to write
    634664            sb = new StringBuilder();
    635             sb.AppendLine("Clinic:");
     665            sb.AppendLine(strings.Clinic + ":");
    636666            sb.AppendLine(appt.Resource);
    637667            sb.AppendLine();
    638             sb.AppendLine("Appointment Provider:");
    639             sb.AppendLine((appt.Provider == null) ? "(none)" : appt.Provider.ToString());  //Appt Provider or (none) if null
    640             sb.AppendLine();
    641             sb.AppendLine("Patient Order:" + "\t" + apptOrder);
    642             sb.AppendLine("Date: " + "\t" + appt.StartTime.ToShortDateString() + " " + appt.StartTime.ToShortTimeString());
    643             sb.AppendLine();
    644             sb.AppendLine("Appointment Note: ");
    645             sb.AppendLine(String.IsNullOrWhiteSpace(appt.Note)? "(none)" : appt.Note);
     668            sb.AppendLine(strings.AppointmentProvider + ":");
     669            sb.AppendLine((appt.Provider == null) ? strings.none : appt.Provider.ToString());  //Appt Provider or (none) if null
     670            sb.AppendLine();
     671            sb.AppendLine(strings.PatientOrder + ":" + "\t" + apptOrder);
     672            sb.AppendLine(strings.Date + ":" + "\t" + appt.StartTime.ToShortDateString() + " " + appt.StartTime.ToShortTimeString());
     673            sb.AppendLine();
     674            sb.AppendLine(strings.AppointmentNote + ":");
     675            sb.AppendLine(String.IsNullOrWhiteSpace(appt.Note)? strings.none : appt.Note);
    646676
    647677            // Draw them
     
    649679
    650680            // Draw them
    651             g.DrawString(sb.ToString(), fBody, Brushes.Black, apptInfoInnerRectangle);
     681            g.DrawString(sb.ToString(), fBody, Brushes.Black, apptInfoInnerRectangle, sf4);
    652682
    653683            // Move Drawing Rectangle Down
     
    665695            printArea.Height -= 5;
    666696
    667             s = "Scratch Area";
    668             g.DrawString(s, fGroupTitle, Brushes.Black, printArea);
    669 
    670             // move down
    671             printArea.Y += 300;
    672             printArea.Height -= 300;
    673 
    674             //TODO: Put Next Appointment Area
     697            s = strings.ScratchArea;
     698            g.DrawString(s, fGroupTitle, Brushes.Black, printArea, sf3);
     699
     700            // move down
     701            printArea.Y += 240;
     702            printArea.Height -= 240;
     703
    675704            using (Pen dashpen = new Pen(Color.Black))
    676705            {
     
    682711            printArea.Height -= 5;
    683712
    684             s = "Next Appointment Instructions";
    685             g.DrawString(s, fGroupTitle, Brushes.Black, printArea);
     713            s = strings.NextAppointmentInstructions;
     714            g.DrawString(s, fGroupTitle, Brushes.Black, printArea, sf3);
    686715
    687716            // Draw Footer
    688717            //use sf0 to print the footer (center all the way)
    689             s = "Printed: " + DateTime.Now.ToString();
     718            s = strings.Printed + ": " + DateTime.Now.ToString();
    690719            Font fFooter = new Font(FontFamily.GenericSerif, 7);
    691720            g.DrawString(s, fFooter, Brushes.Black, footerArea, sf0);
Note: See TracChangeset for help on using the changeset viewer.