Exemplo n.º 1
0
        ///<summary>Draws all the blockouts for the entire period.</summary>
        private void DrawBlockouts(Graphics g)
        {
            Schedule[] schedForType;
            schedForType = Schedules.GetForType(SchedListPeriod, ScheduleType.Blockout, 0);
            SolidBrush blockBrush;
            Pen        blockOutlinePen = new Pen(Color.Black, 1);
            Pen        penOutline;
            Font       blockFont = new Font("Arial", 8);
            string     blockText;
            RectangleF rect;

            //g.TextRenderingHint=TextRenderingHint.SingleBitPerPixelGridFit;//to make printing clearer
            for (int i = 0; i < schedForType.Length; i++)
            {
                blockBrush = new SolidBrush(DefB.GetColor(DefCat.BlockoutTypes, schedForType[i].BlockoutType));
                penOutline = new Pen(DefB.GetColor(DefCat.BlockoutTypes, schedForType[i].BlockoutType), 2);
                blockText  = DefB.GetName(DefCat.BlockoutTypes, schedForType[i].BlockoutType) + "\r\n" + schedForType[i].Note;
                if (IsWeeklyView)
                {
                    if (schedForType[i].Op == 0)                   //all ops
                    {
                        rect = new RectangleF(
                            TimeWidth + 1 + ((int)schedForType[i].SchedDate.DayOfWeek - 1) * ColDayWidth
                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr                       //6
                            + schedForType[i].StartTime.Minute * Lh / MinPerRow                     //10
                            , ColDayWidth - 1
                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr
                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);
                    }
                    else                      //just one op
                    {
                        if (ApptViewItems.GetIndexOp(schedForType[i].Op) == -1)
                        {
                            continue;                            //don't display if op not visible
                        }
                        rect = new RectangleF(
                            TimeWidth + 1 + ((int)schedForType[i].SchedDate.DayOfWeek - 1) * ColDayWidth
                            + ColAptWidth * ApptViewItems.GetIndexOp(schedForType[i].Op) + 1
                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr
                            + schedForType[i].StartTime.Minute * Lh / MinPerRow
                            , ColAptWidth - 1
                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr
                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);
                    }
                }
                else
                {
                    if (schedForType[i].Op == 0)                  //all ops
                    {
                        rect = new RectangleF(
                            TimeWidth + ProvWidth * ProvCount + 1
                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr                       //6
                            + schedForType[i].StartTime.Minute * Lh / MinPerRow                     //10
                            , ColWidth * ColCount - 1
                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr
                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);
                    }
                    else                     //just one op
                    {
                        if (ApptViewItems.GetIndexOp(schedForType[i].Op) == -1)
                        {
                            continue;                            //don't display if op not visible
                        }
                        rect = new RectangleF(
                            TimeWidth + ProvWidth * ProvCount
                            + ColWidth * ApptViewItems.GetIndexOp(schedForType[i].Op) + 1
                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr
                            + schedForType[i].StartTime.Minute * Lh / MinPerRow
                            , ColWidth - 1
                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr
                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);
                    }
                }
                //paint either solid block or outline
                if (PrefB.GetBool("SolidBlockouts"))
                {
                    g.FillRectangle(blockBrush, rect);
                    g.DrawLine(blockOutlinePen, rect.X, rect.Y + 1, rect.Right - 1, rect.Y + 1);
                }
                else
                {
                    g.DrawRectangle(penOutline, rect.X + 1, rect.Y + 2, rect.Width - 2, rect.Height - 3);
                }
                g.DrawString(blockText, blockFont, new SolidBrush(DefB.Short[(int)DefCat.AppointmentColors][5].ItemColor), rect);
            }
        }
Exemplo n.º 2
0
        ///<summary>Draws all the blockouts for the entire day.</summary>
        private void DrawBlockouts(Graphics g)
        {
            SchedDefault[] schedDefs;            //for one type at a time
            Schedule[]     schedForType;
            schedForType = Schedules.GetForType(SchedListDay, ScheduleType.Blockout, 0);
            SolidBrush blockBrush;
            Pen        blockOutlinePen = new Pen(Color.Black, 1);
            Font       blockFont       = new Font("Arial", 8);
            string     blockText;
            RectangleF rect;

            g.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit; //to make printing clearer
            if (schedForType.Length == 0)                                     //use default sched
            {
                schedDefs = SchedDefaults.GetForType(ScheduleType.Blockout, 0);
                for (int i = 0; i < schedDefs.Length; i++)
                {
                    if (schedDefs[i].DayOfWeek == (int)Appointments.DateSelected.DayOfWeek)
                    {
                        blockBrush = new SolidBrush(DefB.GetColor(DefCat.BlockoutTypes, schedDefs[i].BlockoutType));
                        blockText  = DefB.GetName(DefCat.BlockoutTypes, schedDefs[i].BlockoutType);
                        if (schedDefs[i].Op == 0)                      //all ops
                        {
                            rect = new RectangleF(
                                TimeWidth + ProvWidth * ProvCount + 1
                                , schedDefs[i].StartTime.Hour * Lh * RowsPerHr
                                + schedDefs[i].StartTime.Minute * Lh / MinPerRow
                                , ColWidth * ColCount - 1
                                , (schedDefs[i].StopTime - schedDefs[i].StartTime).Hours * Lh * RowsPerHr
                                + (schedDefs[i].StopTime - schedDefs[i].StartTime).Minutes * Lh / MinPerRow);
                        }
                        else                         //just one op
                        {
                            if (ApptViewItems.GetIndexOp(schedDefs[i].Op) == -1)
                            {
                                continue;                                //don't display if op not visible
                            }
                            rect = new RectangleF(
                                TimeWidth + ProvWidth * ProvCount
                                + ColWidth * ApptViewItems.GetIndexOp(schedDefs[i].Op) + 1
                                , schedDefs[i].StartTime.Hour * Lh * RowsPerHr
                                + schedDefs[i].StartTime.Minute * Lh / MinPerRow
                                , ColWidth - 1
                                , (schedDefs[i].StopTime
                                   - schedDefs[i].StartTime).Hours * Lh * RowsPerHr
                                + (schedDefs[i].StopTime
                                   - schedDefs[i].StartTime).Minutes * Lh / MinPerRow);
                        }
                        g.FillRectangle(blockBrush, rect);
                        g.DrawRectangle(blockOutlinePen, rect.X + 1, rect.Y + 2, rect.Width - 2, rect.Height - 4);
                        g.DrawString(blockText, blockFont
                                     , new SolidBrush(DefB.Short[(int)DefCat.AppointmentColors][5].ItemColor), rect);
                    }
                }
            }
            else             //use schedForType
            {
                for (int i = 0; i < schedForType.Length; i++)
                {
                    blockBrush = new SolidBrush(DefB.GetColor(DefCat.BlockoutTypes, schedForType[i].BlockoutType));
                    blockText  = DefB.GetName(DefCat.BlockoutTypes, schedForType[i].BlockoutType) + "\r\n"
                                 + schedForType[i].Note;
                    if (schedForType[i].Op == 0)                  //all ops
                    {
                        rect = new RectangleF(
                            TimeWidth + ProvWidth * ProvCount + 1
                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr                       //6
                            + schedForType[i].StartTime.Minute * Lh / MinPerRow                     //10
                            , ColWidth * ColCount - 1
                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr
                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);
                    }
                    else                     //just one op
                    {
                        if (ApptViewItems.GetIndexOp(schedForType[i].Op) == -1)
                        {
                            continue;                            //don't display if op not visible
                        }
                        rect = new RectangleF(
                            TimeWidth + ProvWidth * ProvCount
                            + ColWidth * ApptViewItems.GetIndexOp(schedForType[i].Op) + 1
                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr
                            + schedForType[i].StartTime.Minute * Lh / MinPerRow
                            , ColWidth - 1
                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr
                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);
                    }
                    g.FillRectangle(blockBrush, rect);
                    //g.DrawRectangle(blockOutlinePen,rect.X,rect.Y+1,rect.Width-1,rect.Height-3);
                    g.DrawLine(blockOutlinePen, rect.X, rect.Y + 1, rect.Right - 1, rect.Y + 1);
                    g.DrawString(blockText, blockFont
                                 , new SolidBrush(DefB.Short[(int)DefCat.AppointmentColors][5].ItemColor), rect);
                }
            }
        }
Exemplo n.º 3
0
        ///<summary>It is planned to move some of this logic to OnPaint and use a true double buffer.</summary>
        public void CreateShadow()
        {
            if (Shadow != null)
            {
                Shadow = null;
            }
            if (Width < 4)
            {
                return;
            }
            if (Height < 4)
            {
                return;
            }
            Shadow = new Bitmap(Width, Height);
            Graphics g     = Graphics.FromImage(Shadow);
            Pen      penB  = new Pen(Color.Black);
            Pen      penW  = new Pen(Color.White);
            Pen      penGr = new Pen(Color.SlateGray);
            Pen      penDG = new Pen(Color.DarkSlateGray);
            Pen      penO;       //provider outline color
            Color    backColor;
            Color    timeColor;

            if (Info.MyApt.AptStatus == ApptStatus.Complete)
            {
                backColor = DefB.Long[(int)DefCat.AppointmentColors][3].ItemColor;
                timeColor = DefB.Long[(int)DefCat.AppointmentColors][2].ItemColor;
                if (Info.MyApt.ProvNum != 0 && !Info.MyApt.IsHygiene)              //dentist
                {
                    penO = new Pen(Providers.GetOutlineColor(Info.MyApt.ProvNum));
                }
                else if (Info.MyApt.ProvHyg != 0 && Info.MyApt.IsHygiene)              //hygienist
                {
                    penO = new Pen(Providers.GetOutlineColor(Info.MyApt.ProvHyg));
                }
                else                 //unknown
                {
                    penO = new Pen(Color.Black);
                }
            }
            else
            {
                if (Info.MyApt.ProvNum != 0 && !Info.MyApt.IsHygiene)              //dentist
                {
                    backColor = Providers.GetColor(Info.MyApt.ProvNum);
                    penO      = new Pen(Providers.GetOutlineColor(Info.MyApt.ProvNum));
                }
                else if (Info.MyApt.ProvHyg != 0 && Info.MyApt.IsHygiene)              //hygienist
                {
                    backColor = Providers.GetColor(Info.MyApt.ProvHyg);
                    penO      = new Pen(Providers.GetOutlineColor(Info.MyApt.ProvHyg));
                }
                else                 //unknown
                {
                    backColor = Color.White;
                    penO      = new Pen(Color.Black);
                }
                timeColor = DefB.GetColor(DefCat.ApptConfirmed, Info.MyApt.Confirmed);
            }
            g.FillRectangle(new SolidBrush(backColor), 7, 0, Width - 7, Height);
            g.FillRectangle(new SolidBrush(timeColor), 0, 0, 7, Height);
            g.DrawLine(penB, 7, 0, 7, Height);
            //Highlighting border
            if (PinBoardIsSelected && ThisIsPinBoard ||
                (Info.MyApt.AptNum == SelectedAptNum && !ThisIsPinBoard))
            {
                //Left
                g.DrawLine(penO, 8, ContrApptSheet.Lh, 8, Height - 2);
                g.DrawLine(penO, 9, ContrApptSheet.Lh, 9, Height - 3);
                //g.DrawLine(penO,10,ContrApptSheet.Lh,10,Height-3);
                g.DrawLine(penO, 14, 1, 14, ContrApptSheet.Lh);
                //Right
                g.DrawLine(penO, Width - 2, 1, Width - 2, Height - 2);
                g.DrawLine(penO, Width - 3, 2, Width - 3, Height - 3);
                //g.DrawLine(penGr,Width-4,2,Width-4,Height-2);
                //Top
                g.DrawLine(penO, 8, ContrApptSheet.Lh, 14, ContrApptSheet.Lh);
                g.DrawLine(penO, 14, 1, Width - 2, 1);
                g.DrawLine(penO, 14, 2, Width - 3, 2);
                //bottom
                g.DrawLine(penO, 9, Height - 2, Width - 2, Height - 2);
                g.DrawLine(penO, 10, Height - 3, Width - 3, Height - 3);
            }
            //Font fontSF=new Font("Arial",8);
            g.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit; //to make printing clearer
            for (int i = 0; i < patternShowing.Length; i++)                   //Info.MyApt.Pattern.Length;i++){
            {
                g.DrawLine(penB, 6, i * ContrApptSheet.Lh + 1, 1, (i + 1) * ContrApptSheet.Lh - 2);
                if (patternShowing.Substring(i, 1) == "X")
                {
                    g.DrawLine(penB, 1, i * ContrApptSheet.Lh + 1, 6, (i + 1) * ContrApptSheet.Lh - 2);
                }
            }
            //elements=new string[] {"PatientName","Note","Lab","Procs"};
            int row      = 0;
            int elementI = 0;

            while (row < patternShowing.Length && elementI < ApptViewItems.ApptRows.Length)
            {
                row += OnDrawElement(g, elementI, row);
                elementI++;
            }
            //Main outline
            g.DrawRectangle(new Pen(Color.Black), 0, 0, Width - 1, Height - 1);
            //Credit and ins
            g.FillRectangle(new SolidBrush(Color.White), 1, 1, 12, ContrApptSheet.Lh - 2);
            g.DrawRectangle(new Pen(Color.Black), 0, 0, 13, ContrApptSheet.Lh - 1);      //started out as 11
            g.DrawString(Info.MyPatient.GetCreditIns(), baseFont, new SolidBrush(Color.Black), 0, -1);
            //assistant box
            if (Info.MyApt.Assistant != 0)
            {
                g.FillRectangle(new SolidBrush(Color.White)
                                , Width - 18, Height - ContrApptSheet.Lh, 17, ContrApptSheet.Lh - 1);
                g.DrawLine(Pens.Gray, Width - 18, Height - ContrApptSheet.Lh, Width, Height - ContrApptSheet.Lh);
                g.DrawLine(Pens.Gray, Width - 18, Height - ContrApptSheet.Lh, Width - 18, Height);
                g.DrawString(Employees.GetAbbr(Info.MyApt.Assistant)
                             , baseFont, new SolidBrush(Color.Black), Width - 18, Height - ContrApptSheet.Lh - 1);
            }
            //g.DrawString(":10",font,new SolidBrush(Color.Black),timeWidth-19,i*Lh*6+Lh-1);
            if (Info.MyApt.AptStatus == ApptStatus.Broken)
            {
                g.DrawLine(new Pen(Color.Black), 8, 1, Width - 1, Height - 1);
                g.DrawLine(new Pen(Color.Black), 8, Height - 1, Width - 1, 1);
            }
            this.BackgroundImage = Shadow;
            //Shadow=null;
            g.Dispose();
        }
Exemplo n.º 4
0
        ///<summary>It is planned to move some of this logic to OnPaint and use a true double buffer.</summary>
        public void CreateShadow()
        {
            if (this.Parent is ContrApptSheet)
            {
                bool isVisible = false;
                for (int j = 0; j < ApptViewItems.VisOps.Length; j++)
                {
                    if (this.DataRoww["Op"].ToString() == Operatories.ListShort[ApptViewItems.VisOps[j]].OperatoryNum.ToString())
                    {
                        isVisible = true;
                    }
                }
                if (!isVisible)
                {
                    return;
                }
            }
            if (Shadow != null)
            {
                Shadow = null;
            }
            if (Width < 4)
            {
                return;
            }
            if (Height < 4)
            {
                return;
            }
            Shadow = new Bitmap(Width, Height);
            Graphics g     = Graphics.FromImage(Shadow);
            Pen      penB  = new Pen(Color.Black);
            Pen      penW  = new Pen(Color.White);
            Pen      penGr = new Pen(Color.SlateGray);
            Pen      penDG = new Pen(Color.DarkSlateGray);
            Pen      penO;       //provider outline color
            Color    backColor;
            Color    provColor;
            Color    confirmColor;

            confirmColor = DefB.GetColor(DefCat.ApptConfirmed, PIn.PInt(DataRoww["Confirmed"].ToString()));
            if (DataRoww["ProvNum"].ToString() != "0" && DataRoww["IsHygiene"].ToString() == "0")        //dentist
            {
                provColor = Providers.GetColor(PIn.PInt(DataRoww["ProvNum"].ToString()));
                penO      = new Pen(Providers.GetOutlineColor(PIn.PInt(DataRoww["ProvNum"].ToString())));
            }
            else if (DataRoww["ProvHyg"].ToString() != "0" && DataRoww["IsHygiene"].ToString() == "1")        //hygienist
            {
                provColor = Providers.GetColor(PIn.PInt(DataRoww["ProvHyg"].ToString()));
                penO      = new Pen(Providers.GetOutlineColor(PIn.PInt(DataRoww["ProvHyg"].ToString())));
            }
            else             //unknown
            {
                provColor = Color.White;
                penO      = new Pen(Color.Black);
            }
            if (PIn.PInt(DataRoww["AptStatus"].ToString()) == (int)ApptStatus.Complete)
            {
                backColor = DefB.Long[(int)DefCat.AppointmentColors][3].ItemColor;
            }
            else if (PIn.PInt(DataRoww["AptStatus"].ToString()) == (int)ApptStatus.PtNote)
            {
                backColor = DefB.Long[(int)DefCat.AppointmentColors][7].ItemColor;
            }
            else if (PIn.PInt(DataRoww["AptStatus"].ToString()) == (int)ApptStatus.PtNoteCompleted)
            {
                backColor = DefB.Long[(int)DefCat.AppointmentColors][10].ItemColor;
            }
            else
            {
                backColor = provColor;
                //We might want to do something interesting here.
            }
            g.FillRectangle(new SolidBrush(backColor), 7, 0, Width - 7, Height);
            g.FillRectangle(Brushes.White, 0, 0, 7, Height);
            g.DrawLine(penB, 7, 0, 7, Height);
            //Highlighting border
            if (PinBoardIsSelected && ThisIsPinBoard ||
                (DataRoww["AptNum"].ToString() == SelectedAptNum.ToString() && !ThisIsPinBoard))
            {
                //Left
                g.DrawLine(penO, 8, 1, 8, Height - 2);
                g.DrawLine(penO, 9, 1, 9, Height - 3);
                //Right
                g.DrawLine(penO, Width - 2, 1, Width - 2, Height - 2);
                g.DrawLine(penO, Width - 3, 2, Width - 3, Height - 3);
                //Top
                g.DrawLine(penO, 8, 1, Width - 2, 1);
                g.DrawLine(penO, 8, 2, Width - 3, 2);
                //bottom
                g.DrawLine(penO, 9, Height - 2, Width - 2, Height - 2);
                g.DrawLine(penO, 10, Height - 3, Width - 3, Height - 3);
            }
            Pen penTimediv = Pens.Silver;

            //g.TextRenderingHint=TextRenderingHint.SingleBitPerPixelGridFit;//to make printing clearer
            for (int i = 0; i < patternShowing.Length; i++)      //Info.MyApt.Pattern.Length;i++){
            {
                if (patternShowing.Substring(i, 1) == "X")
                {
                    g.FillRectangle(new SolidBrush(provColor), 1, i * ContrApptSheet.Lh + 1, 6, ContrApptSheet.Lh);
                }
                else
                {
                }
                if (Math.IEEERemainder((double)i, (double)ContrApptSheet.RowsPerIncr) == 0)             //0/1
                {
                    g.DrawLine(penTimediv, 1, i * ContrApptSheet.Lh, 6, i * ContrApptSheet.Lh);
                }
            }
            //elements=new string[] {"PatientName","Note","Lab","Procs"};
            int row      = 0;
            int elementI = 0;

            while (row < patternShowing.Length && elementI < ApptViewItems.ApptRows.Length)
            {
                row += OnDrawElement(g, elementI, row);
                elementI++;
            }
            //Main outline
            g.DrawRectangle(new Pen(Color.Black), 0, 0, Width - 1, Height - 1);
            //Credit and ins
            if (!ContrApptSheet.IsWeeklyView)
            {
                g.FillRectangle(new SolidBrush(confirmColor), Width - 13, 1, 12, ContrApptSheet.Lh - 2);
                g.DrawRectangle(new Pen(Color.Black), Width - 13, 0, 13, ContrApptSheet.Lh - 1);
                //if note, then draw note symbol ♫
                string strNote = "";
                if (PIn.PInt(DataRoww["AptStatus"].ToString()) == (int)ApptStatus.PtNote ||
                    PIn.PInt(DataRoww["AptStatus"].ToString()) == (int)ApptStatus.PtNoteCompleted)
                {
                    strNote = "♫";
                    g.DrawString(strNote, baseFont, new SolidBrush(Color.DarkBlue), Width - 13, -1);                    //0,-1);
                }
                else
                {
                    if (DataRoww["creditIns"].ToString().Contains("!"))
                    {
                        g.DrawString(strNote + DataRoww["creditIns"].ToString(), boldFont, new SolidBrush(Color.Red), Width - 13, -1);                        //0,-1);
                    }
                    else
                    {
                        g.DrawString(strNote + DataRoww["creditIns"].ToString(), baseFont, new SolidBrush(Color.Black), Width - 13, -1);                //0,-1);
                    }
                }
                //assistant box
                if (DataRoww["Assistant"].ToString() != "0")
                {
                    g.FillRectangle(new SolidBrush(Color.White), Width - 18, Height - ContrApptSheet.Lh, 17, ContrApptSheet.Lh - 1);
                    g.DrawLine(Pens.Gray, Width - 18, Height - ContrApptSheet.Lh, Width, Height - ContrApptSheet.Lh);
                    g.DrawLine(Pens.Gray, Width - 18, Height - ContrApptSheet.Lh, Width - 18, Height);
                    g.DrawString(Employees.GetAbbr(PIn.PInt(DataRoww["Assistant"].ToString()))
                                 , baseFont, new SolidBrush(Color.Black), Width - 18, Height - ContrApptSheet.Lh - 1);
                }
            }
            if (DataRoww["AptStatus"].ToString() == ((int)ApptStatus.Broken).ToString())
            {
                g.DrawLine(new Pen(Color.Black), 8, 1, Width - 1, Height - 1);
                g.DrawLine(new Pen(Color.Black), 8, Height - 1, Width - 1, 1);
            }
            this.BackgroundImage = Shadow;
            //Shadow=null;
            g.Dispose();
        }
Exemplo n.º 5
0
        private void ContrSchedGrid_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            SolidBrush blockBrush = new SolidBrush(Color.White);
            float      blockW     = ColW; //set in each loop
            float      opOffset   = 0;

            if (SchedDefaults.List != null)
            {
                for (int i = 0; i < SchedDefaults.List.Length; i++)
                {
                    if (SchedType == ScheduleType.Practice)                  //for practice
                    {
                        if (SchedDefaults.List[i].SchedType != ScheduleType.Practice)
                        {
                            continue;                            //only show practice blocks
                        }
                    }
                    if (SchedType == ScheduleType.Provider)                  //for providers
                    {
                        if (SchedDefaults.List[i].SchedType != ScheduleType.Provider)
                        {
                            continue;                            //only show prov blocks
                        }
                        if (SchedDefaults.List[i].ProvNum != ProvNum)
                        {
                            continue;                            //only show blocks for this prov
                        }
                    }
                    if (SchedType == ScheduleType.Blockout)                  //for blockouts
                    //only show practice blocks and blockout blocks
                    {
                        if (SchedDefaults.List[i].SchedType == ScheduleType.Provider)
                        {
                            continue;
                        }
                    }
                    if (SchedDefaults.List[i].SchedType == ScheduleType.Practice)                  //open block color
                    {
                        blockBrush = new SolidBrush(DefB.Long[(int)DefCat.AppointmentColors][0].ItemColor);
                        blockW     = ColW;
                        opOffset   = 0;
                    }
                    if (SchedDefaults.List[i].SchedType == ScheduleType.Provider)                  //open block color
                    {
                        blockBrush = new SolidBrush(DefB.Long[(int)DefCat.AppointmentColors][0].ItemColor);
                        blockW     = ColW;
                        opOffset   = 0;
                    }
                    if (SchedDefaults.List[i].SchedType == ScheduleType.Blockout)
                    {
                        blockBrush = new SolidBrush(DefB.GetColor(DefCat.BlockoutTypes
                                                                  , SchedDefaults.List[i].BlockoutType));
                        if (SchedDefaults.List[i].Op == 0)
                        {
                            blockW = ColW;
                        }
                        else
                        {
                            blockW = opW;
                        }
                        if (SchedDefaults.List[i].Op == 0)
                        {
                            opOffset = 0;
                        }
                        else
                        {
                            opOffset = Operatories.GetOrder(SchedDefaults.List[i].Op);
                            if (opOffset == -1)                          //op not visible
                            {
                                continue;
                            }
                            opOffset = opOffset * opW;
                        }
                    }
                    e.Graphics.FillRectangle(blockBrush
                                             , NumW + SchedDefaults.List[i].DayOfWeek * ColW
                                             + opOffset  //usually 0
                                             , SchedDefaults.List[i].StartTime.Hour * 6 * RowH
                                             + (int)SchedDefaults.List[i].StartTime.Minute / 10 * RowH
                                             , blockW
                                             , ((SchedDefaults.List[i].StopTime
                                                 - SchedDefaults.List[i].StartTime).Hours * 6
                                                + (SchedDefaults.List[i].StopTime - SchedDefaults.List[i].StartTime).Minutes / 10) * RowH);
                }
            }
            Pen bPen = new Pen(Color.Black);
            Pen gPen = new Pen(Color.LightGray);

            for (int y = 0; y < 24 * 6; y++)
            {
                e.Graphics.DrawLine(gPen, NumW, y * RowH, NumW + ColW * 7, y * RowH);
            }
            for (int y = 0; y < 25; y++)
            {
                e.Graphics.DrawLine(bPen, NumW, y * RowH * 6, NumW + ColW * 7, y * RowH * 6);
            }
            for (int x = 0; x < 8; x++)
            {
                e.Graphics.DrawLine(bPen, NumW + x * ColW, 0, NumW + x * ColW, RowH * 6 * 24);
            }
            if (SchedDefaults.List != null &&
                SchedType == ScheduleType.Blockout)
            {
                for (int i = 0; i < SchedDefaults.List.Length; i++)
                {
                    if (SchedDefaults.List[i].SchedType == ScheduleType.Blockout)
                    {
                        if (SchedDefaults.List[i].Op == 0)
                        {
                            blockW = ColW;
                        }
                        else
                        {
                            blockW = opW;
                        }
                        if (SchedDefaults.List[i].Op == 0)
                        {
                            opOffset = 0;
                        }
                        else
                        {
                            opOffset = Operatories.GetOrder(SchedDefaults.List[i].Op);
                            if (opOffset == -1)                          //op not visible
                            {
                                continue;
                            }
                            opOffset = opOffset * opW;
                        }
                        e.Graphics.DrawString(
                            DefB.GetName(DefCat.BlockoutTypes, SchedDefaults.List[i].BlockoutType)
                            , blockFont, Brushes.Black
                            , new RectangleF(
                                NumW + SchedDefaults.List[i].DayOfWeek * ColW
                                + opOffset                       //usually 0
                                , SchedDefaults.List[i].StartTime.Hour * 6 * RowH
                                + (int)SchedDefaults.List[i].StartTime.Minute / 10 * RowH
                                , blockW
                                , 15));
                    }
                }
            }
            CultureInfo ci      = (CultureInfo)CultureInfo.CurrentCulture.Clone();
            string      hFormat = Lan.GetShortTimeFormat(ci);

            for (int y = 0; y < 24; y++)
            {
                e.Graphics.DrawString((new DateTime(2000, 1, 1, y, 0, 0)).ToString(hFormat, ci)
                                      , timeFont, new SolidBrush(Color.Black), 0, y * RowH * 6 - 3);
                e.Graphics.DrawString((new DateTime(2000, 1, 1, y, 0, 0)).ToString(hFormat, ci)
                                      , timeFont, new SolidBrush(Color.Black), NumW + ColW * 7, y * RowH * 6 - 3);
            }
            Width  = NumW * 2 + ColW * 7;
            Height = RowH * 24 * 6 + 1;
        }