Exemplo n.º 1
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.º 2
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();
        }