Beispiel #1
0
 private void DrawRectBorder(Graphics g, RectangleF rect)
 {
     #region Внешняя рамка
     DrawUtils.DrawBorder(g, rect, SystemColors.ButtonHighlight, SystemColors.ButtonShadow, 1);
     rect.Inflate(-1, -1);
     using (Pen pen = new Pen(SystemColors.ButtonFace, 2))
         g.DrawRectangle(pen, Rectangle.Ceiling(rect));
     rect.Inflate(-1, -1); // толщина панели
     #endregion
     #region Внутренняя рамка
     DrawUtils.DrawBorder(g, rect, SystemColors.ButtonShadow, SystemColors.ButtonHighlight, 1);
     #endregion
 }
Beispiel #2
0
        public void DrawFigure(Graphics g, IDictionary <string, object> props)
        {
            PointF     location   = new PointF((float)props["Left"], (float)props["Top"]);
            SizeF      size       = new SizeF((float)props["Width"], (float)props["Height"]);
            Color      alarmcolor = (Color)props["BackColor"];
            bool       quit       = (bool)props["QuitAlarms"];
            bool       alarms     = (bool)props["HasAlarms"];
            bool       lostalarms = (bool)props["HasLostAlarms"];
            bool       blink      = (bool)props["Blink"];
            RectangleF rect       = new RectangleF(location, size);

            if ((bool)props["ShowPanel"]) // включен режим показа панели
            {
                #region Внешняя рамка
                DrawUtils.DrawBorder(g, rect, SystemColors.ButtonHighlight, SystemColors.ButtonShadow, 2);
                rect.Inflate(-2, -2);
                using (Pen pen = new Pen(SystemColors.ButtonFace, 2))
                    g.DrawRectangle(pen, Rectangle.Ceiling(rect));
                rect.Inflate(-1, -1); // толщина панели
                #endregion
                #region Внутренняя рамка
                DrawUtils.DrawBorder(g, rect, SystemColors.ButtonShadow, SystemColors.ButtonHighlight, 2);
                rect.Inflate(-2, -2); // толщина границы панели
                #endregion
            }
            #region Вывод текста
            bool noparam = String.IsNullOrWhiteSpace((string)props["PtName"]);
            if ((bool)props["Solid"]) // включен режим заливки фона
            {
                Color backcolor;
                if (noparam)
                {
                    backcolor = (Color)props["Color"];
                }
                else if ((bool)props["PV"])
                {
                    backcolor = (Color)props["Color1"];
                }
                else
                {
                    backcolor = (Color)props["Color0"];
                }
                using (Brush backbrush = new SolidBrush(backcolor))
                    g.FillRectangle(backbrush, rect);
            }
            if ((bool)props["Framed"]) // включен режим вывода рамки
            {
                using (Pen framepen = new Pen((Color)props["FrameColor"]))
                    g.DrawRectangles(framepen, new RectangleF[] { rect });
            }
            string    fontname  = "Tahoma";
            float     fontsize  = 9f;
            FontStyle fontstyle = FontStyle.Regular;
            Color     fontcolor;
            string    value;
            if (noparam)
            {
                if ((bool)props["FontBold"])
                {
                    fontstyle |= FontStyle.Bold;
                }
                if ((bool)props["FontItalic"])
                {
                    fontstyle |= FontStyle.Italic;
                }
                if ((bool)props["FontUnderline"])
                {
                    fontstyle |= FontStyle.Underline;
                }
                if ((bool)props["FontStrikeOut"])
                {
                    fontstyle |= FontStyle.Strikeout;
                }
                fontname  = (string)props["FontName"];
                fontsize  = (float)props["FontSize"];
                fontcolor = (Color)props["FontColor"];
                value     = (string)props["Text"];
            }
            else if ((bool)props["PV"])
            {
                if ((bool)props["Font1Bold"])
                {
                    fontstyle |= FontStyle.Bold;
                }
                if ((bool)props["Font1Italic"])
                {
                    fontstyle |= FontStyle.Italic;
                }
                if ((bool)props["Font1Underline"])
                {
                    fontstyle |= FontStyle.Underline;
                }
                if ((bool)props["Font1StrikeOut"])
                {
                    fontstyle |= FontStyle.Strikeout;
                }
                fontname  = (string)props["Font1Name"];
                fontsize  = (float)props["Font1Size"];
                fontcolor = (Color)props["Font1Color"];
                value     = (string)props["Text1"];
            }
            else
            {
                if ((bool)props["Font0Bold"])
                {
                    fontstyle |= FontStyle.Bold;
                }
                if ((bool)props["Font0Italic"])
                {
                    fontstyle |= FontStyle.Italic;
                }
                if ((bool)props["Font0Underline"])
                {
                    fontstyle |= FontStyle.Underline;
                }
                if ((bool)props["Font0StrikeOut"])
                {
                    fontstyle |= FontStyle.Strikeout;
                }
                fontname  = (string)props["Font0Name"];
                fontsize  = (float)props["Font0Size"];
                fontcolor = (Color)props["Font0Color"];
                value     = (string)props["Text0"];
            }
            try
            {
                using (Font font = new Font(fontname, fontsize, fontstyle))
                {
                    if (!noparam && !props["Quality"].ToString().Equals("GOOD"))
                    {
                        fontcolor = Color.Blue;
                    }
                    using (Brush brush = new SolidBrush(fontcolor))
                    {
                        using (StringFormat sf = new StringFormat())
                        {
                            sf.LineAlignment = StringAlignment.Center;
                            sf.Alignment     = StringAlignment.Center;
                            g.DrawString(value, font, brush, rect, sf);
                        }
                    }
                }
            }
            catch { g.DrawString("Шрифт не поддерживается", SystemFonts.DefaultFont,
                                 SystemBrushes.ControlText, rect); }
            if (!quit && blink && (alarms || lostalarms))
            {
                rect = new RectangleF(location, size);
                using (Pen alarmpen = new Pen(alarmcolor))
                {
                    alarmpen.Width = 2;
                    g.DrawRectangles(alarmpen, new RectangleF[] { rect });
                }
            }
            #endregion
        }
Beispiel #3
0
        public void DrawFigure(Graphics g, IDictionary <string, object> props)
        {
            PointF     location = new PointF((float)props["Left"], (float)props["Top"]);
            SizeF      size     = new SizeF((float)props["Width"], (float)props["Height"]);
            RectangleF rect     = new RectangleF(location, size);

            if ((bool)props["Framed"]) // включен режим показа рамки
            {
                #region Внешняя рамка
                DrawUtils.DrawBorder(g, rect, SystemColors.ButtonHighlight, SystemColors.ButtonShadow, 2);
                rect.Inflate(-2, -2);
                using (Pen pen = new Pen(SystemColors.ButtonFace, 2))
                    g.DrawRectangle(pen, Rectangle.Ceiling(rect));
                rect.Inflate(-1, -1); // толщина панели
                #endregion
                #region Внутренняя рамка
                DrawUtils.DrawBorder(g, rect, SystemColors.ButtonShadow, SystemColors.ButtonHighlight, 2);
                #endregion
            }
            #region Вывод текста
            if ((bool)props["Solid"]) // включен режим заливки фона
            {
                using (Brush backbrush = new SolidBrush((Color)props["Color"]))
                {
                    g.FillRectangle(backbrush, rect);
                }
            }
            FontStyle fontstyle = FontStyle.Regular;
            if ((bool)props["FontBold"])
            {
                fontstyle |= FontStyle.Bold;
            }
            if ((bool)props["FontItalic"])
            {
                fontstyle |= FontStyle.Italic;
            }
            if ((bool)props["FontUnderline"])
            {
                fontstyle |= FontStyle.Underline;
            }
            if ((bool)props["FontStrikeOut"])
            {
                fontstyle |= FontStyle.Strikeout;
            }
            string fontname  = (string)props["FontName"];
            float  fontsize  = (float)props["FontSize"];
            int    keylevel  = (int)props["KeyLevel"];
            int    сurrlevel = (int)props["UserLevel"];
            bool   enabled   = сurrlevel >= keylevel;
            using (Font font = new Font(fontname, fontsize, fontstyle))
            {
                using (Brush brush = new SolidBrush((Color)props["FontColor"]))
                {
                    using (StringFormat sf = new StringFormat())
                    {
                        sf.LineAlignment = StringAlignment.Center;
                        sf.Alignment     = StringAlignment.Center;
                        string value = (string)props["Text"];
                        g.DrawString(value, font, brush, rect, sf);
                    }
                }
            }
            #endregion
        }
Beispiel #4
0
        public void DrawFigure(Graphics g, IDictionary <string, object> props)
        {
            PointF     location   = new PointF((float)props["Left"], (float)props["Top"]);
            SizeF      size       = new SizeF((float)props["Width"], (float)props["Height"]);
            RectangleF rect       = new RectangleF(location, size);
            float      pvpercent  = (float)FloatParse(props["PVPercent"].ToString());
            float      sppercent  = (float)FloatParse(props["SPPercent"].ToString());
            float      oppercent  = (float)FloatParse(props["OPPercent"].ToString());
            Color      backcolor  = (Color)props["BackColor"];
            Color      forecolor  = (Color)props["ForeColor"];
            bool       quit       = (bool)props["QuitAlarms"];
            bool       alarms     = (bool)props["HasAlarms"];
            bool       lostalarms = (bool)props["HasLostAlarms"];
            bool       blink      = (bool)props["Blink"];
            int        konturmode = (int)props["KonturMode"];

            rect = MakeSquare(rect);
            g.FillRectangle(SystemBrushes.ButtonFace, rect);
            #region Внешняя рамка
            DrawUtils.DrawBorder(g, rect, SystemColors.ButtonHighlight, SystemColors.ButtonShadow, 2);
            rect.Inflate(-2, -2); // толщина панели
            #endregion
            #region Показать имя тега, параметр и единицу измерения
            RectangleF tagunitrect = new RectangleF(rect.X, rect.Y, rect.Width, 16);
            DrawUtils.DrawBorder(g, tagunitrect, SystemColors.ButtonShadow, SystemColors.ButtonHighlight, 1);
            // рисовать тег
            using (StringFormat sf = new StringFormat())
            {
                sf.LineAlignment = StringAlignment.Center;
                sf.Alignment     = StringAlignment.Center;
                StringBuilder tagunit = new StringBuilder();
                tagunit.Append((string)props["PtName"]);
                using (Font panelfont = new Font("Courier New", 8))
                {
                    g.DrawString(tagunit.ToString(), panelfont,
                                 SystemBrushes.ControlText, tagunitrect, sf);
                }
            }
            rect.Y      += tagunitrect.Height; // высота панели для тега
            rect.Height -= tagunitrect.Height;
            // рисовать единицу измерения и режим контура
            tagunitrect.Offset(0, tagunitrect.Height);
            using (StringFormat sf = new StringFormat())
            {
                sf.LineAlignment = StringAlignment.Center;
                sf.Alignment     = StringAlignment.Near;
                StringBuilder tagunit = new StringBuilder();
                tagunit.Append((string)props["EUDesc"]);
                using (Font panelfont = new Font("Courier New", 8))
                {
                    g.DrawString(tagunit.ToString(), panelfont,
                                 SystemBrushes.ControlText, tagunitrect, sf);
                }
                sf.Alignment = StringAlignment.Far;
                using (Font panelfont = new Font("Courier New", 8))
                {
                    string[] modes = new string[3] {
                        "РУЧ", "АВТ", "КАС"
                    };
                    Color[] colors = new Color[3] {
                        Color.Yellow, SystemColors.ButtonFace, Color.Aqua
                    };
                    SizeF      smodesize = g.MeasureString(modes[konturmode], panelfont);
                    RectangleF moderect  = tagunitrect;
                    moderect.Width = smodesize.Width;
                    moderect.X     = tagunitrect.X + tagunitrect.Width - moderect.Width;
                    using (Brush brush = new SolidBrush(colors[konturmode]))
                        g.FillRectangle(brush, moderect);
                    g.DrawString(modes[konturmode], panelfont,
                                 SystemBrushes.ControlText, tagunitrect, sf);
                }
            }
            rect.Y      += tagunitrect.Height; // высота панели для юнита и режима контура
            rect.Height -= tagunitrect.Height;
            #endregion
            RectangleF valrect = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height / 3 - 2);
            for (int i = 0; i < 3; i++)
            {
                #region Внутренняя рамка
                DrawUtils.DrawBorder(g, valrect, SystemColors.ButtonShadow, SystemColors.ButtonHighlight, 2);
                #endregion
                #region Вывод значения
                RectangleF barrect = valrect;
                using (Brush backbrush = new SolidBrush((Color)props["Color"]))
                    g.FillRectangle(backbrush, barrect);
                barrect.Inflate(-1, -1);
                float  percent       = 0;
                string text          = String.Empty;
                Color  barlevelcolor = Color.Black;
                switch (i)
                {
                case 0:
                    percent       = pvpercent; text = (string)props["PVText"];
                    barlevelcolor = (Color)props["BarLevelColor"];
                    break;

                case 1:
                    percent       = sppercent; text = (string)props["SPText"];
                    barlevelcolor = (Color)props["BarLevelSPColor"];
                    break;

                case 2:
                    percent       = oppercent; text = (string)props["OPText"] + " %";
                    barlevelcolor = (Color)props["BarLevelOPColor"];
                    break;
                }
                float kf = (percent <= 100f) ? percent / 100f : 1f;
                barrect.Width *= kf;
                using (Brush barbrush = new SolidBrush(barlevelcolor))
                    g.FillRectangle(barbrush, barrect);
                FontStyle style = FontStyle.Regular;
                if ((bool)props["FontBold"])
                {
                    style |= FontStyle.Bold;
                }
                if ((bool)props["FontItalic"])
                {
                    style |= FontStyle.Italic;
                }
                if ((bool)props["FontUnderline"])
                {
                    style |= FontStyle.Underline;
                }
                if ((bool)props["FontStrikeOut"])
                {
                    style |= FontStyle.Strikeout;
                }
                try
                {
                    using (Font font = new Font((string)props["FontName"],
                                                (float)props["FontSize"], style))
                    {
                        Color fontcolor = (alarms) ? backcolor : (Color)props["FontColor"];
                        if (!props["Quality"].ToString().Equals("GOOD"))
                        {
                            fontcolor = Color.Blue;
                        }
                        using (Brush fontbrush = new SolidBrush(fontcolor))
                        {
                            using (StringFormat sf = new StringFormat())
                            {
                                sf.LineAlignment = StringAlignment.Center;
                                sf.Alignment     = StringAlignment.Center;
                                if (g.MeasureString(text, font).Width > valrect.Width)
                                {
                                    text = "#WIDTH#";
                                }
                                valrect.Offset(0, 2);
                                g.DrawString(text, font, fontbrush, valrect, sf);
                                valrect.Offset(0, -2);
                            }
                        }
                    }
                }
                catch
                {
                    using (Font font = new Font("Tahoma", (float)props["FontSize"], style))
                    {
                        using (Brush fontbrush = new SolidBrush((Color)props["FontColor"]))
                            g.DrawString("#FONT#", font, fontbrush, valrect);
                    }
                }
                #endregion
                valrect.Offset(0, valrect.Height + 3);
            }
            if (!quit && blink && (alarms || lostalarms))
            {
                rect = new RectangleF(location, size);
                using (Pen alarmpen = new Pen(backcolor))
                {
                    alarmpen.Width = 2;
                    g.DrawRectangles(alarmpen, new RectangleF[] { rect });
                }
            }
        }
Beispiel #5
0
        public void DrawFigure(Graphics g, IDictionary <string, object> props)
        {
            bool       noparam  = String.IsNullOrWhiteSpace((string)props["PtName"]);
            PointF     location = new PointF((float)props["Left"], (float)props["Top"]);
            SizeF      size     = new SizeF((float)props["Width"], (float)props["Height"]);
            RectangleF rect     = new RectangleF(location, size);

            g.FillRectangle(SystemBrushes.ButtonFace, rect);
            bool pv = false;

            #region Внешняя рамка
            if (noparam || !noparam && !props["Quality"].ToString().Equals("GOOD"))
            {
                DrawUtils.DrawBorder(g, rect, SystemColors.ButtonHighlight, SystemColors.ButtonShadow, 2);
            }
            else
            {
                DrawUtils.DrawBorder(g, rect, SystemColors.ButtonHighlight, SystemColors.ButtonShadow, 2);
                if ((bool)props["PV"])
                {
                    pv = true;
                    rect.Inflate(-1, -1); // толщина панели
                    DrawUtils.DrawBorder(g, rect, SystemColors.ButtonShadow, SystemColors.ButtonHighlight, 2);
                }
            }
            rect.Inflate(-2, -2); // толщина панели
            #endregion
            #region Вывод текста
            FontStyle style = FontStyle.Regular;
            if ((bool)props["FontBold"])
            {
                style |= FontStyle.Bold;
            }
            if ((bool)props["FontItalic"])
            {
                style |= FontStyle.Italic;
            }
            if ((bool)props["FontUnderline"])
            {
                style |= FontStyle.Underline;
            }
            if ((bool)props["FontStrikeOut"])
            {
                style |= FontStyle.Strikeout;
            }
            string fontname = (string)props["FontName"];
            float  fontsize = (float)props["FontSize"];
            int    ilevel   = (int)props["UserLevel"];
            bool   enabled  = ilevel >= UserInfo.UserLevelToInt(UserLevel.Оператор);
            using (Font font = new Font(fontname, fontsize, style))
            {
                using (Brush brush = new SolidBrush((Color)props["FontColor"]))
                {
                    using (StringFormat sf = new StringFormat())
                    {
                        sf.LineAlignment = StringAlignment.Center;
                        sf.Alignment     = StringAlignment.Center;
                        string value = (string)props["Text"];
                        if (pv)
                        {
                            rect.Offset(1, 1);
                        }
                        if (enabled)
                        {
                            g.DrawString(value, font, brush, rect, sf);
                        }
                        else
                        {
                            rect.Offset(1, 1);
                            g.DrawString(value, font, SystemBrushes.ButtonHighlight, rect, sf);
                            rect.Offset(-1, -1);
                            g.DrawString(value, font, SystemBrushes.GrayText, rect, sf);
                        }
                    }
                }
            }
            #endregion
        }
Beispiel #6
0
        public void DrawFigure(Graphics g, IDictionary <string, object> props)
        {
            PointF     location     = new PointF((float)props["Left"], (float)props["Top"]);
            SizeF      size         = new SizeF((float)props["Width"], (float)props["Height"]);
            RectangleF rect         = new RectangleF(location, size);
            bool       showtag      = (bool)props["ShowTag"];
            bool       showunit     = (bool)props["ShowUnit"];
            bool       showvalue    = (bool)props["ShowValue"];
            bool       showpanel    = (bool)props["ShowPanel"];
            int        alignment    = (int)props["Alignment"];
            float      percent      = (float)FloatParse(props["PVPercent"].ToString());
            bool       showlevelbar = (bool)props["BarLevelVisible"];
            Color      backcolor    = (Color)props["BackColor"];
            Color      forecolor    = (Color)props["ForeColor"];
            bool       quit         = (bool)props["QuitAlarms"];
            bool       alarms       = (bool)props["HasAlarms"];
            bool       lostalarms   = (bool)props["HasLostAlarms"];
            bool       blink        = (bool)props["Blink"];

            if (showpanel) // включен режим показа панели
            {
                g.FillRectangle(SystemBrushes.ButtonFace, rect);
                #region Внешняя рамка
                DrawUtils.DrawBorder(g, rect, SystemColors.ButtonHighlight, SystemColors.ButtonShadow, 2);
                rect.Inflate(-2, -2); // толщина панели
                #endregion
                #region Показать имя тега, параметр и единицу измерения
                if (showtag || showunit)
                {
                    RectangleF tagunitrect = new RectangleF(rect.X, rect.Y, rect.Width, 16);
                    DrawUtils.DrawBorder(g, tagunitrect, SystemColors.ButtonShadow, SystemColors.ButtonHighlight, 1);
                    using (StringFormat sf = new StringFormat())
                    {
                        sf.LineAlignment = StringAlignment.Center;
                        sf.Alignment     = StringAlignment.Center;
                        StringBuilder tagunit = new StringBuilder();
                        #region Показать имя тега и параметра
                        if (showtag)
                        {
                            tagunit.Append((string)props["PtName"]);
                        }
                        #endregion
                        #region Показать единицу измерения
                        if (showunit)
                        {
                            string eudesc = (string)props["EUDesc"];
                            eudesc = modifyEuDesc(props, showtag, eudesc);
                            if (eudesc.Trim().Length > 0)
                            {
                                if (showtag)
                                {
                                    tagunit.Append(" ");
                                }
                                tagunit.Append("[");
                                tagunit.Append(eudesc);
                                tagunit.Append("]");
                            }
                        }
                        #endregion
                        using (Font panelfont = new Font("Courier New", 8))
                        {
                            g.DrawString(tagunit.ToString(), panelfont,
                                         SystemBrushes.ControlText, tagunitrect, sf);
                        }
                    }
                    rect.Y      += tagunitrect.Height; // высота панели для тега и юнита
                    rect.Height -= tagunitrect.Height;
                }
                #endregion
                #region Внутренняя рамка
                DrawUtils.DrawBorder(g, rect, SystemColors.ButtonShadow, SystemColors.ButtonHighlight, 2);
                rect.Inflate(-1, -1); // толщина границы панели
                #endregion
            }
            if ((bool)props["Framed"]) // включен режим вывода рамки
            {
                using (Pen framepen = new Pen((Color)props["FrameColor"]))
                    g.DrawRectangles(framepen, new RectangleF[] { rect });
                rect.Inflate(-1, -1);
            }

            #region Вывод значения
            using (Brush backbrush = new SolidBrush((Color)props["Color"]))
                g.FillRectangle(backbrush, rect);
            rect.Inflate(-1, -1);
            rect.Height--;
            if ((bool)props["BarLevelVisible"])
            {
                bool       aslevel = (bool)props["ShowLevel"];
                bool       asbar   = (bool)props["ShowBar"];
                bool       inverse = (bool)props["BarLevelInverse"];
                RectangleF barrect = rect;
                float      kf      = (percent <= 100f) ? percent / 100f : 1f;
                if (asbar)
                {
                    barrect.Width *= kf;
                    if (inverse)
                    {
                        barrect.Offset(rect.Width - barrect.Width, 0f);
                    }
                }
                else if (aslevel)
                {
                    barrect.Height *= kf;
                    if (!inverse)
                    {
                        barrect.Offset(0f, rect.Height - barrect.Height);
                    }
                }
                barrect.Width  += 1;
                barrect.Height += 1;
                using (Brush barbrush = new SolidBrush((Color)props["BarLevelColor"]))
                    g.FillRectangle(barbrush, barrect);
            }
            if (showvalue || showtag)
            {
                FontStyle style = FontStyle.Regular;
                if ((bool)props["FontBold"])
                {
                    style |= FontStyle.Bold;
                }
                if ((bool)props["FontItalic"])
                {
                    style |= FontStyle.Italic;
                }
                if ((bool)props["FontUnderline"])
                {
                    style |= FontStyle.Underline;
                }
                if ((bool)props["FontStrikeOut"])
                {
                    style |= FontStyle.Strikeout;
                }
                try
                {
                    using (Font font = new Font((string)props["FontName"],
                                                (float)props["FontSize"], style))
                    {
                        Color fontcolor = (alarms) ? backcolor : (Color)props["FontColor"];
                        if (!props["Quality"].ToString().Equals("GOOD"))
                        {
                            fontcolor = Color.Blue;
                        }
                        using (Brush fontbrush = new SolidBrush(fontcolor))
                        {
                            using (StringFormat sf = new StringFormat())
                            {
                                sf.LineAlignment = StringAlignment.Center;
                                switch (alignment)
                                {
                                case 0: sf.Alignment = StringAlignment.Near; break;

                                case 1: sf.Alignment = StringAlignment.Center; break;

                                case 2: sf.Alignment = StringAlignment.Far; break;
                                }
                                StringBuilder value = new StringBuilder();
                                if (showvalue)
                                {
                                    string paramname = (string)props["PtParam"];
                                    if (paramname == "PV")
                                    {
                                        value.Append((string)props["PVText"]);
                                    }
                                    else
                                    {
                                        value.Append((string)props[paramname]);
                                    }
                                }
                                if (showunit && !showpanel)
                                {
                                    if (showvalue)
                                    {
                                        value.Append(" ");
                                    }
                                    string eudesc = (string)props["EUDesc"];
                                    eudesc = modifyEuDesc(props, showtag, eudesc);
                                    value.Append(eudesc);
                                }
                                string text = value.ToString();
                                if (g.MeasureString(text, font).Width > rect.Width)
                                {
                                    text = "<-?->";
                                }
                                rect.Offset(0, 2);
                                g.DrawString(text, font, fontbrush, rect, sf);
                            }
                        }
                    }
                }
                catch
                {
                    using (Font font = new Font("Tahoma", (float)props["FontSize"], style))
                    {
                        using (Brush fontbrush = new SolidBrush((Color)props["FontColor"]))
                            g.DrawString("FONT?", font, fontbrush, rect);
                    }
                }
            }
            if (!quit && blink && (alarms || lostalarms))
            {
                rect = new RectangleF(location, size);
                using (Pen alarmpen = new Pen(backcolor))
                {
                    alarmpen.Width = 2;
                    g.DrawRectangles(alarmpen, new RectangleF[] { rect });
                }
            }
            #endregion
        }