protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

//          BufferedGraphicsContext currentContext = BufferedGraphicsManager.Current;
//          BufferedGraphics myBuffer = currentContext.Allocate(e.Graphics, e.ClipRectangle);
//          Graphics g = myBuffer.Graphics;

            Graphics g = e.Graphics;

            g.SmoothingMode      = SmoothingMode.HighQuality;
            g.PixelOffsetMode    = PixelOffsetMode.HighQuality;          //高像素偏移质量
            g.InterpolationMode  = InterpolationMode.HighQualityBicubic;
            g.CompositingQuality = CompositingQuality.HighQuality;

            g.Clear(this.BackColor);


            Color clr1 = Color.FromArgb(235, 242, 252);
            Color clr2 = Color.FromArgb(235, 242, 252);

            for (int i = SelectedIndex + 1; i < _gpBtnArr.Count; i++)
            {
                LinearGradientBrush bsh = new LinearGradientBrush(_gpBtnArr[i].BtnRect, clr1, clr2, 90f);
                g.FillPath(bsh, _gpBtnArr[i].BtnPath);
            }

            if (SelectedIndex > -1)
            {
                clr1 = Color.FromArgb(21, 166, 251);
                clr2 = CommonGraphic.ColorOffset(clr1, -0.1f);

                for (int i = 0; i <= SelectedIndex; i++)
                {
                    LinearGradientBrush bsh = new LinearGradientBrush(_gpBtnArr[i].BtnRect, clr1, clr2, 90f);
                    g.FillPath(bsh, _gpBtnArr[i].BtnPath);
                }
            }

            using (Pen pen = new Pen(Color.FromArgb(91, 159, 238)))
            {
                foreach (var btn in _gpBtnArr)
                {
                    g.DrawPath(pen, btn.BtnPath);
                }
            }

            TextRenderer.DrawText(g,
                                  MicroSteps.ToString(),
                                  this.Font,
                                  _txtRect,
                                  Color.Black,
                                  TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter);

//          myBuffer.Render(e.Graphics);  //呈现图像至关联的Graphics
//          myBuffer.Dispose();
//          g.Dispose();
        }
        protected override void OnSizeChanged(EventArgs e)
        {
            base.OnSizeChanged(e);

            RectangleF rect = ClientRectangle;

            rect.Inflate(-0.5f, -0.5f);
            _path = CommonGraphic.CreateRoundRectPath(rect, _OffsetX, _OffsetY);

            rect.Inflate(-1f, -1f);
            _borderPath = CommonGraphic.CreateRoundRectPath(rect, _OffsetX, _OffsetY);
        }
        public void InitCtrl(uint btnNums)
        {
            Debug.Assert(btnNums > 0);

            _gpBtnArr.Clear();

            float startHeight = ClientRectangle.Bottom * 0.7f;
            float k           = (startHeight - ClientRectangle.Top) / (float)(ClientRectangle.Left - ClientRectangle.Right);

            _txtRect         = ClientRectangle;
            _txtRect.Height /= 3;

            float btnWidth = this.Width / (float)btnNums;

            for (int i = 0; i < btnNums; i++)
            {
                RectangleF rect = new RectangleF();
                rect.X     = i * btnWidth;
                rect.Width = btnWidth;

                rect.Y      = (rect.X - ClientRectangle.Left) * k + startHeight;
                rect.Height = ClientRectangle.Height - rect.Y;

                rect.Inflate(-2f, 0);
                CommonGraphic.ConvertRect(ref rect);

                if (rect.Bottom > ClientRectangle.Bottom)
                {
                    rect.Height -= 1f;
                }

                GraphicButton gpBtn = new GraphicButton();
                gpBtn.BtnRect = rect;
                gpBtn.BtnPath = new GraphicsPath();
                gpBtn.BtnPath.AddRectangle(rect);
                gpBtn.BtnRegion = new Region(gpBtn.BtnPath);

                _gpBtnArr.Add(gpBtn);
            }
        }
示例#4
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
//          BufferedGraphicsContext currentContext = BufferedGraphicsManager.Current;
//          BufferedGraphics myBuffer = currentContext.Allocate(e.Graphics, e.ClipRectangle);
//          Graphics g = myBuffer.Graphics;

            Graphics g = e.Graphics;

            g.SmoothingMode      = SmoothingMode.HighQuality;
            g.PixelOffsetMode    = PixelOffsetMode.HighQuality;          //高像素偏移质量
            g.InterpolationMode  = InterpolationMode.HighQualityBicubic;
            g.CompositingQuality = CompositingQuality.HighQuality;


            g.Clear(this.BackColor);

            Rectangle rect = ClientRectangle;

            if (_totalPath == null)
            {
                _totalPath = CommonGraphic.CreateRoundRectPath(rect, OffsetX, OffsetY);
            }

            Color colorDown = BackColor;
            Color colorUp   = BackColor;

            //绘制控件背景色
            SolidBrush lgb = new SolidBrush(BackColor);

            g.FillPath(lgb, _totalPath);

            if (_gpBtnArr.Count > 0)
            {
                Pen splitPenMain = new Pen(CommonGraphic.ColorOffset(BackColor, -0.2f), 1f);
                Pen splitPenSub  = new Pen(CommonGraphic.ColorOffset(BackColor, 0.2f), 1f);

                Color pressedColor = CommonGraphic.ColorOffset(BackColor, -0.2f);

                Image bkImage = null;

                for (int i = 0; i < _gpBtnArr.Count; i++)
                {
                    bkImage = _gpBtnArr[i].BackgroundImage;

                    if (_gpBtnArr[i].Pressed)
                    {
                        using (SolidBrush btnbsh = new SolidBrush(pressedColor))
                        {
                            g.FillPath(btnbsh, _gpBtnArr[i].BtnPath);
                        }

                        if (_gpBtnArr[i].SelectedBKImage != null)
                        {
                            bkImage = _gpBtnArr[i].SelectedBKImage;
                        }
                    }
                    else if (_gpBtnArr[i].MouseHover)
                    {
                        using (SolidBrush btnbsh = new SolidBrush(CommonGraphic.ColorOffset(this.BackColor, -0.05f) /*CommonGraphic.ColorOffset(Color.White, -240, 0, 0, 0)*/))
                        {
                            g.FillPath(btnbsh, _gpBtnArr[i].BtnPath);
                        }
                    }

                    if (i < _gpBtnArr.Count - 1 &&
                        i != this.MouseHoverIndex - 1 &&
                        i != this.MouseHoverIndex &&
                        i != this.PressedIndex - 1 &&
                        i != this.PressedIndex)
                    {
                        CommonGraphic.DrawLine(g, splitPenMain,
                                               _gpBtnArr[i].BtnRect.Right,
                                               _gpBtnArr[i].BtnRect.Top + 6f,
                                               _gpBtnArr[i].BtnRect.Right,
                                               _gpBtnArr[i].BtnRect.Bottom - 6f);

                        CommonGraphic.DrawLine(g, splitPenSub,
                                               _gpBtnArr[i].BtnRect.Right + 1f,
                                               _gpBtnArr[i].BtnRect.Top + 6f,
                                               _gpBtnArr[i].BtnRect.Right + 1f,
                                               _gpBtnArr[i].BtnRect.Bottom - 6f);
                    }

                    Rectangle txtRect = Rectangle.Round(_gpBtnArr[i].BtnRect);

                    if (bkImage != null)
                    {
                        SizeF fontSize = g.MeasureString(_gpBtnArr[i].Text, this.Font);

                        float height    = (float)Math.Round(_gpBtnArr[i].BtnRect.Height * 0.76f, 1);                                    //图片高度;
                        float width     = (float)Math.Round(height * bkImage.Width / bkImage.Height);                                   //图片宽度;
                        float textWidth = fontSize.Width * 1.3f;                                                                        //文字宽度;

                        float imageLeftOffset = (_gpBtnArr[i].BtnRect.Width - (width + textWidth)) / 2f;                                //图片相对于按钮左边偏移

                        g.DrawImage(bkImage,
                                    _gpBtnArr[i].BtnRect.Left + imageLeftOffset,
                                    _gpBtnArr[i].BtnRect.Top + (_gpBtnArr[i].BtnRect.Height - height) / 2.0f,
                                    width, height);

                        txtRect.Offset((int)(imageLeftOffset + width), 0);
                        txtRect.Width = (int)textWidth;
                    }

                    TextRenderer.DrawText(g,
                                          _gpBtnArr[i].Text,
                                          this.Font,
                                          txtRect,
                                          this.ForeColor,
                                          TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter);
                }
            }

//          myBuffer.Render(e.Graphics);  //呈现图像至关联的Graphics
//          myBuffer.Dispose();
//          g.Dispose();
        }
        protected override void OnPaint(PaintEventArgs pevent)
        {
            base.OnPaint(pevent);
            //	base.OnPaintBackground(pevent);	//绘制按钮背景,透明效果

            Graphics g = pevent.Graphics;

            g.SmoothingMode      = SmoothingMode.HighQuality;
            g.PixelOffsetMode    = PixelOffsetMode.HighQuality;          //高像素偏移质量
            g.InterpolationMode  = InterpolationMode.HighQualityBicubic;
            g.CompositingQuality = CompositingQuality.HighQuality;


            if (_path == null)
            {
                _path = CommonGraphic.CreateRoundRectPath(ClientRectangle, _OffsetX, _OffsetY);
            }

            ////////////////////////////////////////绘制控件背景色/////////////////////////////////////////
            Color colorUp   = Color.FromArgb(69, 162, 217);
            Color colorDown = Color.FromArgb(68, 161, 218);

            switch (_controlState)
            {
            case ControlState.Hover:
                colorUp   = CommonGraphic.ColorOffset(colorUp, 0.2f);
                colorDown = CommonGraphic.ColorOffset(colorDown, 0.2f);
                break;

            case ControlState.Pressed:
                colorUp   = CommonGraphic.ColorOffset(colorUp, -0.2f);
                colorDown = CommonGraphic.ColorOffset(colorDown, -0.2f);
                break;

            default:
                break;
            }

            LinearGradientBrush lgb = new LinearGradientBrush(ClientRectangle,
                                                              colorUp,
                                                              colorDown,
                                                              90f);

            g.FillPath(lgb, _path);

            ////////////////////////////////////////绘制空间边框/////////////////////////////////////////
            Color borderColor = CommonGraphic.ColorOffset(colorDown, -0.2f);
            Pen   pen         = new Pen(borderColor, 1.0f);

            g.DrawPath(pen, _path);

            pen.Color = CommonGraphic.ColorOffset(colorDown, 0.1f);
            g.DrawPath(pen, _borderPath);

            ////////////////////////////////////////绘制文字/////////////////////////////////////////
            Rectangle txtRect = ClientRectangle;

            if (this.BackgroundImage != null)
            {
                float height = this.ClientRectangle.Height * 0.8f;
                float width  = height * this.BackgroundImage.Width / this.BackgroundImage.Height;

                g.DrawImage(this.BackgroundImage, 5, (ClientRectangle.Height - height) / 2.0f, width, height);

                txtRect.Offset((int)height, 0);
                txtRect.Width -= (int)height;
            }
            TextRenderer.DrawText(g,
                                  this.Text,
                                  this.Font,
                                  txtRect,
                                  this.ForeColor,
                                  TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter);
        }
示例#6
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            g.SmoothingMode      = SmoothingMode.HighQuality;
            g.PixelOffsetMode    = PixelOffsetMode.HighQuality;          //高像素偏移质量
            g.InterpolationMode  = InterpolationMode.HighQualityBicubic;
            g.CompositingQuality = CompositingQuality.HighQuality;

            g.Clear(this.BackColor);

            Color bkColor = Color.White;

            if (!this.Enabled)
            {
                bkColor = Color.FromArgb(244, 244, 244);
            }
            using (SolidBrush backBsh = new SolidBrush(bkColor))
            {
                g.FillRectangle(backBsh, this.ClientRectangle);
            }

            using (Pen pen = new Pen(Color.Black))
            {
                g.DrawRectangle(pen, this.ClientRectangle);
            }

            g.TranslateTransform(this.AutoScrollPosition.X, this.AutoScrollPosition.Y);

            if (_gpBtnArr.Count > 0)
            {
                for (int i = 0; i < _gpBtnArr.Count; i++)
                {
                    ItemButton itemBtn = _gpBtnArr[i] as ItemButton;

                    Color     txtColor = Color.Black;
                    Rectangle txtRect  = Rectangle.Round(itemBtn.BtnRect);
                    txtRect.Offset(this.AutoScrollPosition);

                    Pen borderPen = new Pen(Color.Black, 1f);

                    if (itemBtn.Enabled)
                    {
                        if (itemBtn.Download)
                        {
                            txtColor = BackColor;

                            using (SolidBrush btnbsh = new SolidBrush(DownloadColor))
                            {
                                g.FillPath(btnbsh, _gpBtnArr[i].BtnPath);
                            }
                        }
                        else
                        {
                            if (itemBtn.Selected)
                            {
                                txtColor = BackColor;

                                using (SolidBrush btnbsh = new SolidBrush(SelectedColor))
                                {
                                    g.FillPath(btnbsh, _gpBtnArr[i].BtnPath);
                                }
                            }
                            else if (_gpBtnArr[i].MouseHover)
                            {
                                borderPen.Color = Color.Green;
                                borderPen.Width = 2f;
                            }
                        }
                    }
                    else
                    {
                        using (SolidBrush btnbsh = new SolidBrush(Color.LightGray))
                        {
                            g.FillPath(btnbsh, _gpBtnArr[i].BtnPath);
                        }
                    }

                    CommonGraphic.DrawRectangle(g, borderPen,
                                                _gpBtnArr[i].BtnRect.X,
                                                _gpBtnArr[i].BtnRect.Y,
                                                _gpBtnArr[i].BtnRect.Width,
                                                _gpBtnArr[i].BtnRect.Height);

                    if (IsShowCalibStatus)
                    {
                        if (itemBtn.IsCalibrated && CalibrateImage != null)
                        {
                            g.DrawImage(CalibrateImage, itemBtn.CalibImageRect);
                        }
                        else if (!itemBtn.IsCalibrated && UnCalibrateImage != null)
                        {
                            g.DrawImage(UnCalibrateImage, itemBtn.CalibImageRect);
                        }
                    }

                    TextRenderer.DrawText(g,
                                          _gpBtnArr[i].Text,
                                          this.Font,
                                          txtRect,
                                          txtColor,
                                          TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter);
                }
            }

            g.ResetTransform();
        }
        /// <summary>
        /// 初始化控件
        /// </summary>
        /// <param name="holderNum">盒个数</param>
        /// <param name="cupNum">每个盒的杯个数</param>
        /// <param name="hoverObj">捕获对象类型</param>
        virtual public void Init(int holderNum, int cupNum, HoverObject hoverObj)
        {
            if (holderNum < 1 || cupNum < 0)
            {
                throw new Exception("Invalid groupNum or cupNum");
            }

            if (hoverObj == HoverObject.CupHover)
            {
                _cupBtnArr    = _gpBtnArr;
                _holderBtnArr = new List <GraphicButton>();
            }
            else if (hoverObj == HoverObject.SlotHover)
            {
                _cupBtnArr    = new List <GraphicButton>();
                _holderBtnArr = _gpBtnArr;
            }
            else
            {
                _cupBtnArr    = new List <GraphicButton>();
                _holderBtnArr = new List <GraphicButton>();
            }

            _slotNum = holderNum;
            _cupNum  = cupNum;

            //int headerWidth = (this.Width - 2 * 5);				//指示区域总宽度
            int headerHeight = (this.Height - 2 * 5);                           //指示区域总宽度
            int headerWidth  = (int)(IndexHeightFactor * this.Width / 8);       //指示区域高度
            //int slotWidth = headerWidth / _slotNum;				//每一槽的宽度
            int slotWidth = this.Width - 20 * 2 - headerWidth;                  //每一槽的宽度
            //int headerHeight = (int)(IndexHeightFactor * this.Height / 8);					//指示区域高度


            int topOffset = 5;

            //int slotTop = 2 * topOffset + headerHeight;
            int slotTop    = topOffset;
            int slotHeight = (headerHeight - topOffset * holderNum) / holderNum;

            Rectangle indexRect = new Rectangle(10, topOffset, headerWidth, headerHeight);

            indexRect.Width = headerWidth;
            _titlePath      = CommonGraphic.CreateRoundRectPath(indexRect, 10, 10);

            _indexBtn = new HolderButton[_slotNum];

            float indexBtnSize = Math.Min(slotHeight, headerWidth) * IndexBtnSizeFactor;
            float indexOffsetX = (headerWidth - indexBtnSize) / 2.0f;
            float indexOffsetY = (slotHeight - indexBtnSize) / 2.0f;

            float flateVal = 0;

            if (slotHeight <= indexBtnSize)
            {
                flateVal = indexBtnSize / 10;
            }

            float roundSize = slotHeight * 24 / 42f;

            for (int i = 0; i < _slotNum; i++)
            {
                int slotLeft      = indexRect.Left * 2 + headerWidth;
                int slotTopOffset = slotTop * (i + 1) + i * slotHeight;

                RectangleF rect = new RectangleF(indexRect.Left * 2, slotTopOffset, indexBtnSize, indexBtnSize);
                rect.Offset(indexOffsetX, indexOffsetY);
                rect.Inflate(-flateVal, -flateVal);

                HolderButton indexBtn = new HolderButton();
                indexBtn.BtnRect = rect;
                indexBtn.BtnPath = new GraphicsPath();
                indexBtn.BtnPath.AddEllipse(rect);
                indexBtn.BtnRegion = new Region(indexBtn.BtnRect);
                indexBtn.Text      = "T" + (i + 1).ToString();
                indexBtn.HeaderBtn = true;
                _indexBtn[i]       = indexBtn;

                Rectangle slotRect = new Rectangle(slotLeft + 10, slotTopOffset, slotWidth, slotHeight);

                slotRect.Inflate(_slotOffsetX, 0);
                HolderButton holderBtn = new HolderButton();
                holderBtn.BtnRect   = slotRect;
                holderBtn.BtnPath   = CommonGraphic.CreateRoundRectPath(slotRect, roundSize, roundSize);
                holderBtn.BtnRegion = new Region(holderBtn.BtnPath);
                _holderBtnArr.Add(holderBtn);

                if (_cupNum > 0)
                {
                    int cupHeight   = slotHeight;
                    int offset      = (slotHeight - cupHeight) / 2;
                    int widthOffset = 0;
                    for (int j = 0; j < _cupNum; j++)
                    {
                        int        cupTop  = widthOffset + slotTop * (i + 1) + i * slotHeight;
                        int        cupLeft = slotLeft + 10 + (slotWidth - cupHeight * _cupNum) / (_cupNum + 1) + ((slotWidth - 2 * ((slotWidth - cupHeight * _cupNum) / (_cupNum + 1)) - cupHeight) / (_cupNum - 1)) * j;
                        RectangleF cupRect = new RectangleF(cupLeft, cupTop, slotHeight, cupHeight);
                        if (offset > 0)
                        {
                            cupRect.Inflate(-widthOffset - offset, -widthOffset);
                        }
                        else
                        {
                            cupRect.Inflate(-widthOffset, -widthOffset + offset);
                        }

                        CupButton cupBtn = new CupButton();
                        cupBtn.BtnRect = cupRect;
                        cupBtn.BtnPath = new GraphicsPath();
                        cupBtn.BtnPath.AddEllipse(cupRect);
                        cupBtn.BtnRegion = new Region(cupBtn.BtnPath);

                        _cupBtnArr.Add(cupBtn);
                    }
                }
            }
        }
示例#8
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            Graphics g = e.Graphics;

            g.SmoothingMode      = SmoothingMode.HighQuality;
            g.PixelOffsetMode    = PixelOffsetMode.HighQuality;          //高像素偏移质量
            g.InterpolationMode  = InterpolationMode.HighQualityBicubic;
            g.CompositingQuality = CompositingQuality.HighQuality;

            g.Clear(this.BackColor);

            Rectangle rect = ClientRectangle;

            if (_totalPath == null)
            {
                _totalPath = new GraphicsPath();

                _totalPath.Reset();
                _totalPath.AddRectangle(ClientRectangle);
            }

            SolidBrush bsh = new SolidBrush(BackColor);

            g.FillPath(bsh, _totalPath);

            if (_gpBtnArr.Count > 0)
            {
                Pen splitPenUp   = new Pen(CommonGraphic.ColorOffset(BackColor, -0.3f), 1.5f);
                Pen splitPenDown = new Pen(CommonGraphic.ColorOffset(BackColor, 0.2f), 1.5f);

                Image bkImage = null;

                for (int i = 0; i < _gpBtnArr.Count; i++)
                {
                    Color     txtColor = Color.White;
                    Rectangle txtRect  = Rectangle.Round(_gpBtnArr[i].BtnRect);

                    bkImage = _gpBtnArr[i].BackgroundImage;

                    if (_gpBtnArr[i].Selected)
                    {
                        txtColor = Color.White;

                        if (_gpBtnArr[i].SelectedBKImage != null)
                        {
                            bkImage = _gpBtnArr[i].SelectedBKImage;
                        }

                        SolidBrush btnbsh = new SolidBrush(SelectedColor);
                        g.FillPath(btnbsh, _gpBtnArr[i].BtnPath);

                        Color spiltLine = CommonGraphic.ColorOffset(SelectedColor, -0.3f);

                        Pen linePen = new Pen(spiltLine);
                        g.DrawLine(linePen,
                                   _gpBtnArr[i].BtnRect.Right,
                                   _gpBtnArr[i].BtnRect.Top + 10.0f,
                                   _gpBtnArr[i].BtnRect.Right,
                                   _gpBtnArr[i].BtnRect.Bottom - 10.0f);
                    }
                    else if (_gpBtnArr[i].MouseHover)
                    {
                        txtRect.Inflate(-5, -5);
                        txtRect.Offset(5, 5);
                    }

                    if (i != this.SelectedIndex - 1 &&
                        i != this.SelectedIndex)
                    {
                        CommonGraphic.DrawLine(g, splitPenUp,
                                               _gpBtnArr[i].BtnRect.Left + 2f,
                                               _gpBtnArr[i].BtnRect.Bottom,
                                               _gpBtnArr[i].BtnRect.Right - 2f,
                                               _gpBtnArr[i].BtnRect.Bottom);

                        CommonGraphic.DrawLine(g, splitPenDown,
                                               _gpBtnArr[i].BtnRect.Left + 2f,
                                               _gpBtnArr[i].BtnRect.Bottom + 1,
                                               _gpBtnArr[i].BtnRect.Right - 2f,
                                               _gpBtnArr[i].BtnRect.Bottom + 1);
                    }

                    if (bkImage != null)
                    {
                        float height = _gpBtnArr[i].BtnRect.Height * 0.5f;
                        float width  = height * bkImage.Width / bkImage.Height;

                        g.DrawImage(bkImage,
                                    _gpBtnArr[i].BtnRect.Left + (_gpBtnArr[i].BtnRect.Height - width) / 2.0f,
                                    _gpBtnArr[i].BtnRect.Top + (_gpBtnArr[i].BtnRect.Height - height) / 2.0f,
                                    width, height);

                        txtRect.Offset((int)_gpBtnArr[i].BtnRect.Height, 0);
                        txtRect.Width -= (int)_gpBtnArr[i].BtnRect.Height;
                    }

                    TextRenderer.DrawText(g,
                                          _gpBtnArr[i].Text,
                                          this.Font,
                                          txtRect,
                                          txtColor,
                                          /*TextFormatFlags.HorizontalCenter | */ TextFormatFlags.VerticalCenter);

                    if (_highLightDic.ContainsKey(i))
                    {
                        if (_highLightDic[i] > 0)
                        {
                            Rectangle numRect = new Rectangle();
                            numRect.X      = (int)_gpBtnArr[i].BtnRect.Right - 35;
                            numRect.Y      = (int)_gpBtnArr[i].BtnRect.Top + (int)_gpBtnArr[i].BtnRect.Height / 2 - 15;
                            numRect.Width  = 30;
                            numRect.Height = 30;

                            bsh.Color = Color.Red;
                            g.FillEllipse(bsh, numRect);

                            numRect.Offset(0, -2);
                            TextRenderer.DrawText(g,
                                                  _highLightDic[i].ToString(),
                                                  _numFont,
                                                  numRect,
                                                  Color.White,
                                                  TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter);
                        }
                    }
                }

                if (EnableDisplayTime)
                {
                    TextRenderer.DrawText(g,
                                          DateTime.Now.ToString(TimeFormat),
                                          this.TimeFont,
                                          _timeRect,
                                          Color.White,
                                          TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter);
                }
            }
        }