private void butOK_Click(object sender, System.EventArgs e)
 {
     if (OldFieldName != textName.Text)
     {
         if (ApptFieldDefs.GetExists(x => x.FieldName == textName.Text))
         {
             MsgBox.Show(this, "Field name currently being used.");
             return;
         }
     }
     FieldDef.FieldName = textName.Text;
     FieldDef.FieldType = (ApptFieldType)comboFieldType.SelectedIndex;
     if (FieldDef.FieldType == ApptFieldType.PickList)
     {
         if (textPickList.Text == "")
         {
             MsgBox.Show(this, "List cannot be blank.");
             return;
         }
         FieldDef.PickList = textPickList.Text;
     }
     if (IsNew)
     {
         ApptFieldDefs.Insert(FieldDef);
     }
     else
     {
         ApptFieldDefs.Update(FieldDef, OldFieldName);
     }
     DialogResult = DialogResult.OK;
 }
Example #2
0
 private void FillGrid()
 {
     ApptFieldDefs.RefreshCache();
     listMain.Items.Clear();
     for (int i = 0; i < ApptFieldDefs.Listt.Count; i++)
     {
         listMain.Items.Add(ApptFieldDefs.Listt[i].FieldName);
     }
 }
Example #3
0
 private void FillGrid()
 {
     ApptFieldDefs.RefreshCache();
     _listApptFieldDefs = ApptFieldDefs.GetDeepCopy();
     listMain.Items.Clear();
     for (int i = 0; i < _listApptFieldDefs.Count; i++)
     {
         listMain.Items.Add(_listApptFieldDefs[i].FieldName);
     }
 }
Example #4
0
 private void buttonDelete_Click(object sender, EventArgs e)
 {
     if (IsNew)
     {
         DialogResult = DialogResult.Cancel;
         return;
     }
     try{
         ApptFieldDefs.Delete(FieldDef);
         DialogResult = DialogResult.OK;
     }
     catch (ApplicationException ex) {
         MessageBox.Show(ex.Message);
     }
 }
Example #5
0
        private void FormApptFieldPickEdit_Load(object sender, EventArgs e)
        {
            labelName.Text = _field.FieldName;
            string value = ApptFieldDefs.GetPickListByFieldName(_field.FieldName);

            string[] valueArray = value.Split(new string[] { "\r\n" }, StringSplitOptions.None);
            foreach (string s in valueArray)
            {
                listBoxPick.Items.Add(s);
            }
            if (!_field.IsNew)
            {
                listBoxPick.SelectedItem = _field.FieldValue;
            }
        }
 private void buttonDelete_Click(object sender, EventArgs e)
 {
     if (IsNew)
     {
         DialogResult = DialogResult.Cancel;
         return;
     }
     try{
         ApptFieldDefs.Delete(FieldDef);                                                          //Throws if in use.
         FieldDefLinks.DeleteForFieldDefNum(FieldDef.ApptFieldDefNum, FieldDefTypes.Appointment); //Delete any FieldDefLinks to this ApptFieldDef
         DialogResult = DialogResult.OK;
     }
     catch (ApplicationException ex) {
         MessageBox.Show(ex.Message);
     }
 }
Example #7
0
 private void FormFieldDefLink_Load(object sender, EventArgs e)
 {
     string[] arrayFieldLocations = Enum.GetNames(typeof(FieldLocations));
     for (int i = 0; i < arrayFieldLocations.Length; i++)
     {
         comboFieldLocation.Items.Add(Lan.g("enumFieldLocations", arrayFieldLocations[i]));
         if (i == (int)_fieldLocation)
         {
             comboFieldLocation.SelectedIndex = i;
         }
     }
     _listFieldDefLinks = FieldDefLinks.GetAll();
     _listApptFieldDefs = ApptFieldDefs.GetDeepCopy();
     _listPatFieldDefs  = PatFieldDefs.GetDeepCopy(true);
     FillGridDisplayed();
     FillGridHidden();
 }
Example #8
0
 private void FormApptViewItemEdit_Load(object sender, EventArgs e)
 {
     if (ApptVItem.ApptFieldDefNum > 0)
     {
         textDesc.Text = ApptFieldDefs.GetFieldName(ApptVItem.ApptFieldDefNum);
     }
     else
     {
         textDesc.Text = ApptVItem.ElementDesc;
     }
     panelColor.BackColor = ApptVItem.ElementColor;
     for (int i = 0; i < Enum.GetNames(typeof(ApptViewAlignment)).Length; i++)
     {
         listAlignment.Items.Add(Enum.GetNames(typeof(ApptViewAlignment))[i]);
     }
     listAlignment.SelectedIndex = (int)ApptVItem.ElementAlignment;
 }
Example #9
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     FieldDef.FieldName = textName.Text;
     try {
         if (IsNew)
         {
             ApptFieldDefs.Insert(FieldDef);
         }
         else
         {
             ApptFieldDefs.Update(FieldDef, OldFieldName);
         }
     }
     catch (ApplicationException ex) {
         MessageBox.Show(ex.Message);
         return;
     }
     DialogResult = DialogResult.OK;
 }
Example #10
0
 private void FormApptViewItemEdit_Load(object sender, EventArgs e)
 {
     if (ApptVItem.ApptFieldDefNum > 0)
     {
         textDesc.Text = ApptFieldDefs.GetFieldName(ApptVItem.ApptFieldDefNum);
     }
     else
     {
         textDesc.Text = ApptVItem.ElementDesc;
     }
     panelColor.BackColor = ApptVItem.ElementColor;
     for (int i = 0; i < Enum.GetNames(typeof(ApptViewAlignment)).Length; i++)
     {
         listAlignment.Items.Add(Enum.GetNames(typeof(ApptViewAlignment))[i]);
     }
     listAlignment.SelectedIndex = (int)ApptVItem.ElementAlignment;
     if (textDesc.Text == "ProcsColored")
     {
         //This is the one field where setting the color would be meaningless.
         labelBeforeTime.Visible = false;
         panelColor.Visible      = false;
         butColor.Visible        = false;
     }
 }
Example #11
0
        ///<summary></summary>
        public static Point DrawElement(Graphics g, int elementI, Point drawLoc, ApptViewStackBehavior stackBehavior, ApptViewAlignment align, Brush backBrush, DataRow dataRoww, List <ApptViewItem> apptRows, DataTable tableApptFields, DataTable tablePatFields, float totalWidth, float totalHeight, int fontSize, bool isPrinting)
        {
            Font   baseFont = new Font("Arial", fontSize);
            string text     = "";
            bool   isNote   = false;

            #region FillText
            if (PIn.Long(dataRoww["AptStatus"].ToString()) == (int)ApptStatus.PtNote ||
                PIn.Long(dataRoww["AptStatus"].ToString()) == (int)ApptStatus.PtNoteCompleted)
            {
                isNote = true;
            }
            bool isGraphic = false;
            if (apptRows[elementI].ElementDesc == "ConfirmedColor")
            {
                isGraphic = true;
            }
            if (apptRows[elementI].ApptFieldDefNum > 0)
            {
                string fieldName = ApptFieldDefs.GetFieldName(apptRows[elementI].ApptFieldDefNum);
                for (int i = 0; i < tableApptFields.Rows.Count; i++)
                {
                    if (tableApptFields.Rows[i]["AptNum"].ToString() != dataRoww["AptNum"].ToString())
                    {
                        continue;
                    }
                    if (tableApptFields.Rows[i]["FieldName"].ToString() != fieldName)
                    {
                        continue;
                    }
                    text = tableApptFields.Rows[i]["FieldValue"].ToString();
                }
            }
            else if (apptRows[elementI].PatFieldDefNum > 0)
            {
                string fieldName = PatFieldDefs.GetFieldName(apptRows[elementI].PatFieldDefNum);
                for (int i = 0; i < tablePatFields.Rows.Count; i++)
                {
                    if (tablePatFields.Rows[i]["PatNum"].ToString() != dataRoww["PatNum"].ToString())
                    {
                        continue;
                    }
                    if (tablePatFields.Rows[i]["FieldName"].ToString() != fieldName)
                    {
                        continue;
                    }
                    text = tablePatFields.Rows[i]["FieldValue"].ToString();
                }
            }
            else
            {
                switch (apptRows[elementI].ElementDesc)
                {
                case "Address":
                    if (isNote)
                    {
                        text = "";
                    }
                    else
                    {
                        text = dataRoww["address"].ToString();
                    }
                    break;

                case "AddrNote":
                    if (isNote)
                    {
                        text = "";
                    }
                    else
                    {
                        text = dataRoww["addrNote"].ToString();
                    }
                    break;

                case "Age":
                    if (isNote)
                    {
                        text = "";
                    }
                    else
                    {
                        text = dataRoww["age"].ToString();
                    }
                    break;

                case "ASAP":
                    if (isNote)
                    {
                        text = "";
                    }
                    else
                    {
                        if (dataRoww["AptStatus"].ToString() == ((int)ApptStatus.ASAP).ToString())
                        {
                            text = Lans.g("enumApptStatus", "ASAP");
                        }
                    }
                    break;

                case "ASAP[A]":
                    if (dataRoww["AptStatus"].ToString() == ((int)ApptStatus.ASAP).ToString())
                    {
                        text = "A";
                    }
                    break;

                case "AssistantAbbr":
                    if (isNote)
                    {
                        text = "";
                    }
                    else
                    {
                        text = dataRoww["assistantAbbr"].ToString();
                    }
                    break;

                case "ChartNumAndName":
                    text = dataRoww["chartNumAndName"].ToString();
                    break;

                case "ChartNumber":
                    text = dataRoww["chartNumber"].ToString();
                    break;

                case "CreditType":
                    text = dataRoww["CreditType"].ToString();
                    break;

                case "Guardians":
                    if (isNote)
                    {
                        text = "";
                    }
                    else
                    {
                        text = dataRoww["guardians"].ToString();
                    }
                    break;

                case "HasIns[I]":
                    text = dataRoww["hasIns[I]"].ToString();
                    break;

                case "HmPhone":
                    if (isNote)
                    {
                        text = "";
                    }
                    else
                    {
                        text = dataRoww["hmPhone"].ToString();
                    }
                    break;

                case "InsToSend[!]":
                    text = dataRoww["insToSend[!]"].ToString();
                    break;

                case "Lab":
                    if (isNote)
                    {
                        text = "";
                    }
                    else
                    {
                        text = dataRoww["lab"].ToString();
                    }
                    break;

                case "MedOrPremed[+]":
                    if (isNote)
                    {
                        text = "";
                    }
                    else
                    {
                        text = dataRoww["medOrPremed[+]"].ToString();
                    }
                    break;

                case "MedUrgNote":
                    if (isNote)
                    {
                        text = "";
                    }
                    else
                    {
                        text = dataRoww["MedUrgNote"].ToString();
                    }
                    break;

                case "Note":
                    text = dataRoww["Note"].ToString();
                    break;

                case "PatientName":
                    text = dataRoww["patientName"].ToString();
                    break;

                case "PatientNameF":
                    text = dataRoww["patientNameF"].ToString();
                    break;

                case "PatNum":
                    text = dataRoww["patNum"].ToString();
                    break;

                case "PatNumAndName":
                    text = dataRoww["patNumAndName"].ToString();
                    break;

                case "PremedFlag":
                    if (isNote)
                    {
                        text = "";
                    }
                    else
                    {
                        text = dataRoww["preMedFlag"].ToString();
                    }
                    break;

                case "Procs":
                    if (isNote)
                    {
                        text = "";
                    }
                    else
                    {
                        text = dataRoww["procs"].ToString();
                    }
                    break;

                case "ProcsColored":
                    string   value  = dataRoww["procsColored"].ToString();
                    string[] lines  = value.Split(new string[] { "</span>" }, StringSplitOptions.RemoveEmptyEntries);
                    Point    tempPt = new Point();
                    tempPt = drawLoc;
                    int lastH = 0;
                    int count = 1;
                    for (int i = 0; i < lines.Length; i++)
                    {
                        Match  m      = Regex.Match(lines[i], "^<span color=\"(-?[0-9]*)\">(.*)$");
                        string rgbInt = m.Result("$1");
                        string proc   = m.Result("$2");
                        if (lines[i] != lines[lines.Length - 1])
                        {
                            proc += ",";
                        }
                        if (rgbInt == "")
                        {
                            rgbInt = apptRows[elementI].ElementColorXml.ToString();
                        }
                        Color            c          = Color.FromArgb(Convert.ToInt32(rgbInt));
                        StringFormat     procFormat = new StringFormat();
                        RectangleF       procRect   = new RectangleF(0, 0, 1000, 1000);
                        CharacterRange[] ranges     = { new CharacterRange(0, proc.Length) };
                        Region[]         regions    = new Region[1];
                        procFormat.SetMeasurableCharacterRanges(ranges);
                        regions = g.MeasureCharacterRanges(proc, baseFont, procRect, procFormat);
                        if (regions.Length == 0)
                        {
                            procRect = new RectangleF(0, 0, 0, 0);
                        }
                        else
                        {
                            procRect = regions[0].GetBounds(g);
                        }
                        if (tempPt.X + procRect.Width > totalWidth)
                        {
                            tempPt.X  = drawLoc.X;
                            tempPt.Y += lastH;
                            count++;
                        }
                        SolidBrush sb = new SolidBrush(c);
                        g.DrawString(proc, baseFont, sb, tempPt);
                        DisposeObjects(procFormat, sb);
                        tempPt.X += (int)procRect.Width + 3;                            //+3 is room for spaces
                        if ((int)procRect.Height > lastH)
                        {
                            lastH = (int)procRect.Height;
                        }
                    }
                    drawLoc.Y += lastH * count;
                    return(drawLoc);

                case "Production":
                    if (isNote)
                    {
                        text = "";
                    }
                    else
                    {
                        text = dataRoww["production"].ToString();
                    }
                    break;

                case "Provider":
                    if (isNote)
                    {
                        text = "";
                    }
                    else
                    {
                        text = dataRoww["provider"].ToString();
                    }
                    break;

                case "TimeAskedToArrive":
                    if (isNote)
                    {
                        text = "";
                    }
                    else
                    {
                        text = dataRoww["timeAskedToArrive"].ToString();                              //could be blank
                    }
                    break;

                case "WirelessPhone":
                    if (isNote)
                    {
                        text = "";
                    }
                    else
                    {
                        text = dataRoww["wirelessPhone"].ToString();
                    }
                    break;

                case "WkPhone":
                    if (isNote)
                    {
                        text = "";
                    }
                    else
                    {
                        text = dataRoww["wkPhone"].ToString();
                    }
                    break;
                }
            }
            #endregion
            if (text == "" && !isGraphic)
            {
                return(drawLoc);               //next element will draw at the same position as this one would have.
            }
            SolidBrush brush      = new SolidBrush(apptRows[elementI].ElementColor);
            SolidBrush brushWhite = new SolidBrush(Color.White);
            //SolidBrush noteTitlebrush = new SolidBrush(DefC.Long[(int)DefCat.AppointmentColors][8].ItemColor);
            StringFormat format = new StringFormat();
            format.Alignment = StringAlignment.Near;
            int        charactersFitted;     //not used, but required as 'out' param for measureString.
            int        linesFilled;
            SizeF      noteSize;
            RectangleF rect;
            RectangleF rectBack;
            #region Main
            if (align == ApptViewAlignment.Main)           //always stacks vertical
            {
                if (isGraphic)
                {
                    Bitmap bitmap = new Bitmap(12, 12);
                    noteSize = new SizeF(bitmap.Width, bitmap.Height);
                    rect     = new RectangleF(drawLoc, noteSize);
                    using (Graphics gfx = Graphics.FromImage(bitmap)) {
                        gfx.SmoothingMode = SmoothingMode.HighQuality;
                        Color      confirmColor = DefC.GetColor(DefCat.ApptConfirmed, PIn.Long(dataRoww["Confirmed"].ToString()));
                        SolidBrush confirmBrush = new SolidBrush(confirmColor);
                        gfx.FillEllipse(confirmBrush, 0, 0, 11, 11);
                        gfx.DrawEllipse(Pens.Black, 0, 0, 11, 11);
                        confirmBrush.Dispose();
                    }
                    g.DrawImage(bitmap, drawLoc.X, drawLoc.Y);
                    DisposeObjects(brush, brushWhite, format, bitmap);
                    return(new Point(drawLoc.X, drawLoc.Y + (int)noteSize.Height));
                }
                else
                {
                    noteSize = g.MeasureString(text, baseFont, (int)totalWidth - 9);
                    //Problem: "limited-tooth bothering him ", the trailing space causes measuring error, resulting in m getting partially chopped off.
                    //Tried TextRenderer, but it caused premature wrapping
                    //Size noteSizeInt=TextRenderer.MeasureText(text,baseFont,new Size(totalWidth-9,1000));
                    //noteSize=new SizeF(noteSizeInt.totalWidth,noteSizeInt.totalHeight);
                    noteSize.Width = (float)Math.Ceiling((double)noteSize.Width);                  //round up to nearest int solves specific problem discussed above.
                    if (drawLoc.Y + noteSize.Height > totalHeight && isPrinting)
                    {
                        //This keeps text from drawing off the appointment when font is large. Only if isPrinting cause not sure if this will cause bugs.
                        //No need to do this check when drawing to the appt screen cause its just an image on a control which clips itself.
                        noteSize.Height = totalHeight - drawLoc.Y;
                    }
                    g.MeasureString(text, baseFont, noteSize, format, out charactersFitted, out linesFilled);
                    rect = new RectangleF(drawLoc, noteSize);
                    g.DrawString(text, baseFont, brush, rect, format);
                    DisposeObjects(brush, brushWhite, format);
                    return(new Point(drawLoc.X, drawLoc.Y + linesFilled * ApptDrawing.LineH));
                }
            }
            #endregion
            #region UR
            else if (align == ApptViewAlignment.UR)
            {
                if (stackBehavior == ApptViewStackBehavior.Vertical)
                {
                    float w = totalWidth - 9;
                    if (isGraphic)
                    {
                        Bitmap bitmap = new Bitmap(12, 12);
                        noteSize = new SizeF(bitmap.Width, bitmap.Height);
                        Point drawLocThis = new Point(drawLoc.X - (int)noteSize.Width, drawLoc.Y + 1);                 //upper left corner of this element
                        rect = new RectangleF(drawLoc, noteSize);
                        using (Graphics gfx = Graphics.FromImage(bitmap)) {
                            gfx.SmoothingMode = SmoothingMode.HighQuality;
                            Color      confirmColor = DefC.GetColor(DefCat.ApptConfirmed, PIn.Long(dataRoww["Confirmed"].ToString()));
                            SolidBrush confirmBrush = new SolidBrush(confirmColor);
                            gfx.FillEllipse(confirmBrush, 0, 0, 11, 11);
                            gfx.DrawEllipse(Pens.Black, 0, 0, 11, 11);
                            confirmBrush.Dispose();
                        }
                        g.DrawImage(bitmap, drawLocThis.X, drawLocThis.Y);
                        DisposeObjects(brush, brushWhite, format, bitmap);
                        return(new Point(drawLoc.X, drawLoc.Y + (int)noteSize.Height));
                    }
                    else
                    {
                        noteSize = g.MeasureString(text, baseFont, (int)w);
                        noteSize = new SizeF(noteSize.Width, ApptDrawing.LineH + 1);                   //only allowed to be one line high.
                        if (noteSize.Width < 5)
                        {
                            noteSize = new SizeF(5, noteSize.Height);
                        }
                        //g.MeasureString(text,baseFont,noteSize,format,out charactersFitted,out linesFilled);
                        Point drawLocThis = new Point(drawLoc.X - (int)noteSize.Width, drawLoc.Y);                   //upper left corner of this element
                        rect     = new RectangleF(drawLocThis, noteSize);
                        rectBack = new RectangleF(drawLocThis.X, drawLocThis.Y + 1, noteSize.Width, ApptDrawing.LineH);
                        if (apptRows[elementI].ElementDesc == "MedOrPremed[+]" ||
                            apptRows[elementI].ElementDesc == "HasIns[I]" ||
                            apptRows[elementI].ElementDesc == "InsToSend[!]")
                        {
                            g.FillRectangle(brush, rectBack);
                            g.DrawString(text, baseFont, Brushes.Black, rect, format);
                        }
                        else
                        {
                            g.FillRectangle(brushWhite, rectBack);
                            g.DrawString(text, baseFont, brush, rect, format);
                        }
                        g.DrawRectangle(Pens.Black, rectBack.X, rectBack.Y, rectBack.Width, rectBack.Height);
                        DisposeObjects(brush, brushWhite, format);
                        return(new Point(drawLoc.X, drawLoc.Y + ApptDrawing.LineH));                    //move down a certain number of lines for next element.
                    }
                }
                else                       //horizontal
                {
                    int w = drawLoc.X - 9; //drawLoc is upper right of each element.  The first element draws at (totalWidth-1,0).
                    if (isGraphic)
                    {
                        Bitmap bitmap = new Bitmap(12, 12);
                        noteSize = new SizeF(bitmap.Width, bitmap.Height);
                        Point drawLocThis = new Point(drawLoc.X - (int)noteSize.Width, drawLoc.Y + 1);                 //upper left corner of this element
                        rect = new RectangleF(drawLoc, noteSize);
                        using (Graphics gfx = Graphics.FromImage(bitmap)) {
                            gfx.SmoothingMode = SmoothingMode.HighQuality;
                            Color      confirmColor = DefC.GetColor(DefCat.ApptConfirmed, PIn.Long(dataRoww["Confirmed"].ToString()));
                            SolidBrush confirmBrush = new SolidBrush(confirmColor);
                            gfx.FillEllipse(confirmBrush, 0, 0, 11, 11);
                            gfx.DrawEllipse(Pens.Black, 0, 0, 11, 11);
                            confirmBrush.Dispose();
                        }
                        g.DrawImage(bitmap, drawLocThis.X, drawLocThis.Y);
                        DisposeObjects(brush, brushWhite, format, bitmap);
                        return(new Point(drawLoc.X - (int)noteSize.Width - 2, drawLoc.Y));
                    }
                    else
                    {
                        noteSize = g.MeasureString(text, baseFont, w);
                        noteSize = new SizeF(noteSize.Width, ApptDrawing.LineH + 1);                   //only allowed to be one line high.  Needs an extra pixel.
                        if (noteSize.Width < 5)
                        {
                            noteSize = new SizeF(5, noteSize.Height);
                        }
                        Point drawLocThis = new Point(drawLoc.X - (int)noteSize.Width, drawLoc.Y);                   //upper left corner of this element
                        rect     = new RectangleF(drawLocThis, noteSize);
                        rectBack = new RectangleF(drawLocThis.X, drawLocThis.Y + 1, noteSize.Width, ApptDrawing.LineH);
                        if (apptRows[elementI].ElementDesc == "MedOrPremed[+]" ||
                            apptRows[elementI].ElementDesc == "HasIns[I]" ||
                            apptRows[elementI].ElementDesc == "InsToSend[!]")
                        {
                            g.FillRectangle(brush, rectBack);
                            g.DrawString(text, baseFont, Brushes.Black, rect, format);
                        }
                        else
                        {
                            g.FillRectangle(brushWhite, rectBack);
                            g.DrawString(text, baseFont, brush, rect, format);
                        }
                        g.DrawRectangle(Pens.Black, rectBack.X, rectBack.Y, rectBack.Width, rectBack.Height);
                        DisposeObjects(brush, brushWhite, format);
                        return(new Point(drawLoc.X - (int)noteSize.Width - 1, drawLoc.Y));                  //Move to left.  Might also have to subtract a little from x to space out elements.
                    }
                }
            }
            #endregion
            #region LR
            else              //LR
            {
                if (stackBehavior == ApptViewStackBehavior.Vertical)
                {
                    float w = totalWidth - 9;
                    if (isGraphic)
                    {
                        Bitmap bitmap = new Bitmap(12, 12);
                        noteSize = new SizeF(bitmap.Width, bitmap.Height);
                        Point drawLocThis = new Point(drawLoc.X - (int)noteSize.Width, drawLoc.Y + 1 - ApptDrawing.LineH);               //upper left corner of this element
                        rect = new RectangleF(drawLoc, noteSize);
                        using (Graphics gfx = Graphics.FromImage(bitmap)) {
                            gfx.SmoothingMode = SmoothingMode.HighQuality;
                            Color      confirmColor = DefC.GetColor(DefCat.ApptConfirmed, PIn.Long(dataRoww["Confirmed"].ToString()));
                            SolidBrush confirmBrush = new SolidBrush(confirmColor);
                            gfx.FillEllipse(confirmBrush, 0, 0, 11, 11);
                            gfx.DrawEllipse(Pens.Black, 0, 0, 11, 11);
                            confirmBrush.Dispose();
                        }
                        g.DrawImage(bitmap, drawLocThis.X, drawLocThis.Y);
                        DisposeObjects(brush, brushWhite, format, bitmap);
                        return(new Point(drawLoc.X, drawLoc.Y - (int)noteSize.Height));
                    }
                    else
                    {
                        noteSize = g.MeasureString(text, baseFont, (int)w);
                        noteSize = new SizeF(noteSize.Width, ApptDrawing.LineH + 1);                   //only allowed to be one line high.  Needs an extra pixel.
                        if (noteSize.Width < 5)
                        {
                            noteSize = new SizeF(5, noteSize.Height);
                        }
                        //g.MeasureString(text,baseFont,noteSize,format,out charactersFitted,out linesFilled);
                        Point drawLocThis = new Point(drawLoc.X - (int)noteSize.Width, drawLoc.Y - ApptDrawing.LineH);                 //upper left corner of this element
                        rect     = new RectangleF(drawLocThis, noteSize);
                        rectBack = new RectangleF(drawLocThis.X, drawLocThis.Y + 1, noteSize.Width, ApptDrawing.LineH);
                        if (apptRows[elementI].ElementDesc == "MedOrPremed[+]" ||
                            apptRows[elementI].ElementDesc == "HasIns[I]" ||
                            apptRows[elementI].ElementDesc == "InsToSend[!]")
                        {
                            g.FillRectangle(brush, rectBack);
                            g.DrawString(text, baseFont, Brushes.Black, rect, format);
                        }
                        else
                        {
                            g.FillRectangle(brushWhite, rectBack);
                            g.DrawString(text, baseFont, brush, rect, format);
                        }
                        g.DrawRectangle(Pens.Black, rectBack.X, rectBack.Y, rectBack.Width, rectBack.Height);
                        DisposeObjects(brush, brushWhite, format);
                        return(new Point(drawLoc.X, drawLoc.Y - ApptDrawing.LineH));                    //move up a certain number of lines for next element.
                    }
                }
                else                       //horizontal
                {
                    int w = drawLoc.X - 9; //drawLoc is upper right of each element.  The first element draws at (totalWidth-1,0).
                    if (isGraphic)
                    {
                        Bitmap bitmap = new Bitmap(12, 12);
                        noteSize = new SizeF(bitmap.Width, bitmap.Height);
                        Point drawLocThis = new Point(drawLoc.X - (int)noteSize.Width + 1, drawLoc.Y + 1 - ApptDrawing.LineH);             //upper left corner of this element
                        rect = new RectangleF(drawLoc, noteSize);
                        using (Graphics gfx = Graphics.FromImage(bitmap)) {
                            gfx.SmoothingMode = SmoothingMode.HighQuality;
                            Color      confirmColor = DefC.GetColor(DefCat.ApptConfirmed, PIn.Long(dataRoww["Confirmed"].ToString()));
                            SolidBrush confirmBrush = new SolidBrush(confirmColor);
                            gfx.FillEllipse(confirmBrush, 0, 0, 11, 11);
                            gfx.DrawEllipse(Pens.Black, 0, 0, 11, 11);
                            confirmBrush.Dispose();
                        }
                        g.DrawImage(bitmap, drawLocThis.X, drawLocThis.Y);
                        DisposeObjects(brush, brushWhite, format, bitmap);
                        return(new Point(drawLoc.X - (int)noteSize.Width - 1, drawLoc.Y));
                    }
                    else
                    {
                        noteSize = g.MeasureString(text, baseFont, w);
                        noteSize = new SizeF(noteSize.Width, ApptDrawing.LineH + 1);                   //only allowed to be one line high.  Needs an extra pixel.
                        if (noteSize.Width < 5)
                        {
                            noteSize = new SizeF(5, noteSize.Height);
                        }
                        Point drawLocThis = new Point(drawLoc.X - (int)noteSize.Width, drawLoc.Y - ApptDrawing.LineH);                 //upper left corner of this element
                        rect     = new RectangleF(drawLocThis, noteSize);
                        rectBack = new RectangleF(drawLocThis.X, drawLocThis.Y + 1, noteSize.Width, ApptDrawing.LineH);
                        if (apptRows[elementI].ElementDesc == "MedOrPremed[+]" ||
                            apptRows[elementI].ElementDesc == "HasIns[I]" ||
                            apptRows[elementI].ElementDesc == "InsToSend[!]")
                        {
                            g.FillRectangle(brush, rectBack);
                            g.DrawString(text, baseFont, Brushes.Black, rect, format);
                        }
                        else
                        {
                            g.FillRectangle(brushWhite, rectBack);
                            g.DrawString(text, baseFont, brush, rect, format);
                        }
                        g.DrawRectangle(Pens.Black, rectBack.X, rectBack.Y, rectBack.Width, rectBack.Height);
                        DisposeObjects(brush, brushWhite, format);
                        return(new Point(drawLoc.X - (int)noteSize.Width - 1, drawLoc.Y));                  //Move to left.  Subtract a little from x to space out elements.
                    }
                }
            }
            #endregion
        }