Esempio n. 1
0
        private void DrawWatches(Graphics g)
        {
            Hashtable watchTeeth = new Hashtable(TcData.ListToothGraphics.Count);

            for (int t = 0; t < TcData.ListToothGraphics.Count; t++)       //loop through each adult tooth
            {
                ToothGraphic toothGraphic = TcData.ListToothGraphics[t];
                //If a tooth is marked to be watched then it is always visible, even if the tooth is missing/hidden.
                if (toothGraphic.ToothID == "implant" || !toothGraphic.Watch || Tooth.IsPrimary(toothGraphic.ToothID))
                {
                    continue;
                }
                watchTeeth[toothGraphic.ToothID] = toothGraphic;
            }
            for (int t = 0; t < TcData.ListToothGraphics.Count; t++)       //loop through each primary tooth
            {
                ToothGraphic toothGraphic = TcData.ListToothGraphics[t];
                //If a tooth is marked to be watched then it is always visible, even if the tooth is missing/hidden.
                if (toothGraphic.ToothID == "implant" || !toothGraphic.Watch || !Tooth.IsPrimary(toothGraphic.ToothID) || !toothGraphic.Visible)
                {
                    continue;
                }
                watchTeeth[Tooth.PriToPerm(toothGraphic.ToothID)] = toothGraphic;
            }
            foreach (DictionaryEntry toothGraphic in watchTeeth)
            {
                RenderToothWatch(g, (ToothGraphic)toothGraphic.Value);
            }
        }
Esempio n. 2
0
        ///<summary>Draws the number and the rectangle behind it.  Draws in the appropriate color</summary>
        private void DrawNumber(string tooth_id, bool isSelected, bool isFullRedraw, Graphics g)
        {
            if (DesignMode)
            {
                return;
            }
            if (TcData == null)
            {
                return;                //trying to fix a designtime bug.
            }
            if (!Tooth.IsValidDB(tooth_id))
            {
                return;
            }
            if (TcData.ListToothGraphics[tooth_id] == null)
            {
                //throw new Exception(tooth_id+" null");
                return;                                            //for some reason, it's still getting to here in DesignMode
            }
            if (isFullRedraw)                                      //if redrawing all numbers
            {
                if (TcData.ListToothGraphics[tooth_id].HideNumber) //and this is a "hidden" number
                {
                    return;                                        //skip
                }
                if (Tooth.IsPrimary(tooth_id) &&
                    !TcData.ListToothGraphics[Tooth.PriToPerm(tooth_id)].ShowPrimaryLetter)                       //but not set to show primary letters
                {
                    return;
                }
            }
            string    displayNum    = Tooth.GetToothLabelGraphic(tooth_id, TcData.ToothNumberingNomenclature);
            float     toMm          = 1f / TcData.ScaleMmToPix;
            float     labelWidthMm  = g.MeasureString(displayNum, Font).Width / TcData.ScaleMmToPix;
            float     labelHeightMm = ((float)Font.Height - .5f) / TcData.ScaleMmToPix;
            SizeF     labelSizeF    = new SizeF(labelWidthMm, (float)Font.Height / TcData.ScaleMmToPix);
            Rectangle rec           = TcData.GetNumberRecPix(tooth_id, labelSizeF);

            //Rectangle recPix=TcData.ConvertRecToPix(recMm);
            if (isSelected)
            {
                g.FillRectangle(new SolidBrush(TcData.ColorBackHighlight), rec);
            }
            else
            {
                g.FillRectangle(new SolidBrush(TcData.ColorBackground), rec);
            }
            if (TcData.ListToothGraphics[tooth_id].HideNumber)             //If number is hidden.
            //do not print string
            {
            }
            else if (Tooth.IsPrimary(tooth_id) &&
                     !TcData.ListToothGraphics[Tooth.PriToPerm(tooth_id)].ShowPrimaryLetter)
            {
                //do not print string
            }
            else if (isSelected)
            {
                g.DrawString(displayNum, Font, new SolidBrush(TcData.ColorTextHighlight), rec.X, rec.Y);
            }
            else
            {
                g.DrawString(displayNum, Font, new SolidBrush(TcData.ColorText), rec.X, rec.Y);
            }
        }