Ejemplo n.º 1
0
        /// <summary>
        /// This method will paint the control.
        /// </summary>
        /// <param name="g">The paint event graphics object.</param>
        private void PaintBack(System.Drawing.Graphics g)
        {
            //Set Graphics smoothing mode to Anit-Alias
            g.SmoothingMode = SmoothingMode.AntiAlias;

            //Declare Variables
            int ArcWidth  = this.RoundCorners * 2;
            int ArcHeight = this.RoundCorners * 2;
            int ArcX1     = 0;
            int ArcX2     = (this.ShadowControl) ? (this.Width - (ArcWidth + 1)) - this.ShadowThickness : this.Width - (ArcWidth + 1);
            int ArcY1     = 10;
            int ArcY2     = (this.ShadowControl) ? (this.Height - (ArcHeight + 1)) - this.ShadowThickness : this.Height - (ArcHeight + 1);

            System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
            System.Drawing.Brush BorderBrush           = new SolidBrush(this.BorderColor);
            System.Drawing.Pen   BorderPen             = new Pen(BorderBrush, this.BorderThickness);
            System.Drawing.Drawing2D.LinearGradientBrush BackgroundGradientBrush = null;
            System.Drawing.Brush                  BackgroundBrush = new SolidBrush(this.BackgroundColor);
            System.Drawing.SolidBrush             ShadowBrush     = null;
            System.Drawing.Drawing2D.GraphicsPath ShadowPath      = null;

            //Check if shadow is needed
            if (this.ShadowControl)
            {
                ShadowBrush = new SolidBrush(this.ShadowColor);
                ShadowPath  = new System.Drawing.Drawing2D.GraphicsPath();
                ShadowPath.AddArc(ArcX1 + this.ShadowThickness, ArcY1 + this.ShadowThickness, ArcWidth, ArcHeight, 180, GroupBoxConstants.SweepAngle); // Top Left
                ShadowPath.AddArc(ArcX2 + this.ShadowThickness, ArcY1 + this.ShadowThickness, ArcWidth, ArcHeight, 270, GroupBoxConstants.SweepAngle); //Top Right
                ShadowPath.AddArc(ArcX2 + this.ShadowThickness, ArcY2 + this.ShadowThickness, ArcWidth, ArcHeight, 360, GroupBoxConstants.SweepAngle); //Bottom Right
                ShadowPath.AddArc(ArcX1 + this.ShadowThickness, ArcY2 + this.ShadowThickness, ArcWidth, ArcHeight, 90, GroupBoxConstants.SweepAngle);  //Bottom Left
                ShadowPath.CloseAllFigures();

                //Paint Rounded Rectangle
                g.FillPath(ShadowBrush, ShadowPath);
            }

            //Create Rounded Rectangle Path
            path.AddArc(ArcX1, ArcY1, ArcWidth, ArcHeight, 180, GroupBoxConstants.SweepAngle); // Top Left
            path.AddArc(ArcX2, ArcY1, ArcWidth, ArcHeight, 270, GroupBoxConstants.SweepAngle); //Top Right
            path.AddArc(ArcX2, ArcY2, ArcWidth, ArcHeight, 360, GroupBoxConstants.SweepAngle); //Bottom Right
            path.AddArc(ArcX1, ArcY2, ArcWidth, ArcHeight, 90, GroupBoxConstants.SweepAngle);  //Bottom Left
            path.CloseAllFigures();

            //Check if Gradient Mode is enabled
            if (this.BackgroundGradientMode == GroupBoxGradientMode.None)
            {
                //Paint Rounded Rectangle
                g.FillPath(BackgroundBrush, path);
            }
            else
            {
                BackgroundGradientBrush = new LinearGradientBrush(new Rectangle(0, 0, this.Width, this.Height), this.BackgroundColor, this.BackgroundGradientColor, (LinearGradientMode)this.BackgroundGradientMode);

                //Paint Rounded Rectangle
                g.FillPath(BackgroundGradientBrush, path);
            }

            //Paint Borded
            g.DrawPath(BorderPen, path);

            //Destroy Graphic Objects
            if (path != null)
            {
                path.Dispose();
            }
            if (BorderBrush != null)
            {
                BorderBrush.Dispose();
            }
            if (BorderPen != null)
            {
                BorderPen.Dispose();
            }
            if (BackgroundGradientBrush != null)
            {
                BackgroundGradientBrush.Dispose();
            }
            if (BackgroundBrush != null)
            {
                BackgroundBrush.Dispose();
            }
            if (ShadowBrush != null)
            {
                ShadowBrush.Dispose();
            }
            if (ShadowPath != null)
            {
                ShadowPath.Dispose();
            }
        }
Ejemplo n.º 2
0
        /// <summary>This method will paint the control.</summary>
        /// <param name="g">The paint event graphics object.</param>
        private void PaintBack(Graphics g)
        {
            //Set Graphics smoothing mode to Anit-Alias--
            g.SmoothingMode = SmoothingMode.AntiAlias;
            //-------------------------------------------

            //Declare Variables------------------
            int                 ArcWidth                = RoundCorners * 2;
            int                 ArcHeight               = RoundCorners * 2;
            int                 ArcX1                   = 0;
            int                 ArcX2                   = (ShadowControl) ? (Width - (ArcWidth + 1)) - ShadowThickness : Width - (ArcWidth + 1);
            int                 ArcY1                   = 10;
            int                 ArcY2                   = (ShadowControl) ? (Height - (ArcHeight + 1)) - ShadowThickness : Height - (ArcHeight + 1);
            GraphicsPath        path                    = new GraphicsPath();
            Brush               BorderBrush             = new SolidBrush(BorderColor);
            Pen                 BorderPen               = new Pen(BorderBrush, BorderThickness);
            LinearGradientBrush BackgroundGradientBrush = null;
            Brush               BackgroundBrush         = new SolidBrush(BackgroundColor);
            SolidBrush          ShadowBrush             = null;
            GraphicsPath        ShadowPath              = null;

            //-----------------------------------

            //Check if shadow is needed----------
            if (ShadowControl)
            {
                ShadowBrush = new SolidBrush(ShadowColor);
                ShadowPath  = new GraphicsPath();
                ShadowPath.AddArc(ArcX1 + ShadowThickness, ArcY1 + ShadowThickness, ArcWidth, ArcHeight, 180, GroupBoxConstants.SweepAngle); // TopCount Left
                ShadowPath.AddArc(ArcX2 + ShadowThickness, ArcY1 + ShadowThickness, ArcWidth, ArcHeight, 270, GroupBoxConstants.SweepAngle); //TopCount Right
                ShadowPath.AddArc(ArcX2 + ShadowThickness, ArcY2 + ShadowThickness, ArcWidth, ArcHeight, 360, GroupBoxConstants.SweepAngle); //Bottom Right
                ShadowPath.AddArc(ArcX1 + ShadowThickness, ArcY2 + ShadowThickness, ArcWidth, ArcHeight, 90, GroupBoxConstants.SweepAngle);  //Bottom Left
                ShadowPath.CloseAllFigures();

                //Paint Rounded Rectangle------------
                g.FillPath(ShadowBrush, ShadowPath);
                //-----------------------------------
            }
            //-----------------------------------

            //Create Rounded Rectangle Path------
            path.AddArc(ArcX1, ArcY1, ArcWidth, ArcHeight, 180, GroupBoxConstants.SweepAngle); // TopCount Left
            path.AddArc(ArcX2, ArcY1, ArcWidth, ArcHeight, 270, GroupBoxConstants.SweepAngle); //TopCount Right
            path.AddArc(ArcX2, ArcY2, ArcWidth, ArcHeight, 360, GroupBoxConstants.SweepAngle); //Bottom Right
            path.AddArc(ArcX1, ArcY2, ArcWidth, ArcHeight, 90, GroupBoxConstants.SweepAngle);  //Bottom Left
            path.CloseAllFigures();
            //-----------------------------------

            //Check if Gradient Mode is enabled--
            if (BackgroundGradientMode == GroupBoxGradientMode.None)
            {
                //Paint Rounded Rectangle------------
                g.FillPath(BackgroundBrush, path);
                //-----------------------------------
            }
            else
            {
                BackgroundGradientBrush = new LinearGradientBrush(new Rectangle(0, 0, Width, Height), BackgroundColor, BackgroundGradientColor, (LinearGradientMode)BackgroundGradientMode);

                //Paint Rounded Rectangle------------
                g.FillPath(BackgroundGradientBrush, path);
                //-----------------------------------
            }
            //-----------------------------------

            //Paint Borded-----------------------
            g.DrawPath(BorderPen, path);
            //-----------------------------------

            //Destroy Graphic Objects------------
            if (path != null)
            {
                path.Dispose();
            }
            if (BorderBrush != null)
            {
                BorderBrush.Dispose();
            }
            if (BorderPen != null)
            {
                BorderPen.Dispose();
            }
            if (BackgroundGradientBrush != null)
            {
                BackgroundGradientBrush.Dispose();
            }
            if (BackgroundBrush != null)
            {
                BackgroundBrush.Dispose();
            }
            if (ShadowBrush != null)
            {
                ShadowBrush.Dispose();
            }
            if (ShadowPath != null)
            {
                ShadowPath.Dispose();
            }
            //-----------------------------------
        }
Ejemplo n.º 3
0
        /// <summary>
        /// This method will paint the group title.
        /// </summary>
        /// <param name="g">The paint event graphics object.</param>
        private void PaintGroupText(System.Drawing.Graphics g)
        {
            //Check if string has something
            if (this.GroupTitle == string.Empty)
            {
                return;
            }

            //Set Graphics smoothing mode to Anit-Alias
            g.SmoothingMode = SmoothingMode.AntiAlias;

            //Declare Variables
            SizeF StringSize  = g.MeasureString(this.GroupTitle, this.Font);
            Size  StringSize2 = StringSize.ToSize();

            if (this.GroupImage != null)
            {
                StringSize2.Width += 18;
            }
            int ArcWidth  = this.RoundCorners;
            int ArcHeight = this.RoundCorners;
            int ArcX1     = 20;
            int ArcX2     = (StringSize2.Width + 34) - (ArcWidth + 1);
            int ArcY1     = 0;
            int ArcY2     = 24 - (ArcHeight + 1);

            System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
            System.Drawing.Brush BorderBrush           = new SolidBrush(this.BorderColor);
            System.Drawing.Pen   BorderPen             = new Pen(BorderBrush, this.BorderThickness);
            System.Drawing.Drawing2D.LinearGradientBrush BackgroundGradientBrush = null;
            System.Drawing.Brush                  BackgroundBrush = (this.PaintGroupBox) ? new SolidBrush(this.CustomGroupBoxColor) : new SolidBrush(this.BackgroundColor);
            System.Drawing.SolidBrush             TextColorBrush  = new SolidBrush(this.ForeColor);
            System.Drawing.SolidBrush             ShadowBrush     = null;
            System.Drawing.Drawing2D.GraphicsPath ShadowPath      = null;

            //Check if shadow is needed
            if (this.ShadowControl)
            {
                ShadowBrush = new SolidBrush(this.ShadowColor);
                ShadowPath  = new System.Drawing.Drawing2D.GraphicsPath();
                ShadowPath.AddArc(ArcX1 + (this.ShadowThickness - 1), ArcY1 + (this.ShadowThickness - 1), ArcWidth, ArcHeight, 180, GroupBoxConstants.SweepAngle); // Top Left
                ShadowPath.AddArc(ArcX2 + (this.ShadowThickness - 1), ArcY1 + (this.ShadowThickness - 1), ArcWidth, ArcHeight, 270, GroupBoxConstants.SweepAngle); //Top Right
                ShadowPath.AddArc(ArcX2 + (this.ShadowThickness - 1), ArcY2 + (this.ShadowThickness - 1), ArcWidth, ArcHeight, 360, GroupBoxConstants.SweepAngle); //Bottom Right
                ShadowPath.AddArc(ArcX1 + (this.ShadowThickness - 1), ArcY2 + (this.ShadowThickness - 1), ArcWidth, ArcHeight, 90, GroupBoxConstants.SweepAngle);  //Bottom Left
                ShadowPath.CloseAllFigures();

                //Paint Rounded Rectangle
                g.FillPath(ShadowBrush, ShadowPath);
            }
            //Create Rounded Rectangle Path
            path.AddArc(ArcX1, ArcY1, ArcWidth, ArcHeight, 180, GroupBoxConstants.SweepAngle); // Top Left
            path.AddArc(ArcX2, ArcY1, ArcWidth, ArcHeight, 270, GroupBoxConstants.SweepAngle); //Top Right
            path.AddArc(ArcX2, ArcY2, ArcWidth, ArcHeight, 360, GroupBoxConstants.SweepAngle); //Bottom Right
            path.AddArc(ArcX1, ArcY2, ArcWidth, ArcHeight, 90, GroupBoxConstants.SweepAngle);  //Bottom Left
            path.CloseAllFigures();

            //Check if Gradient Mode is enabled
            if (this.PaintGroupBox)
            {
                //Paint Rounded Rectangle
                g.FillPath(BackgroundBrush, path);
            }
            else
            {
                if (this.BackgroundGradientMode == GroupBoxGradientMode.None)
                {
                    //Paint Rounded Rectangle
                    g.FillPath(BackgroundBrush, path);
                }
                else
                {
                    BackgroundGradientBrush = new LinearGradientBrush(new Rectangle(0, 0, this.Width, this.Height), this.BackgroundColor, this.BackgroundGradientColor, (LinearGradientMode)this.BackgroundGradientMode);

                    //Paint Rounded Rectangle
                    g.FillPath(BackgroundGradientBrush, path);
                }
            }
            //Paint Borded
            g.DrawPath(BorderPen, path);

            //Paint Text
            int CustomStringWidth = (this.GroupImage != null) ? 44 : 28;

            g.DrawString(this.GroupTitle, this.Font, TextColorBrush, CustomStringWidth, 5);

            //Draw GroupImage if there is one
            if (this.GroupImage != null)
            {
                g.DrawImage(this.GroupImage, 28, 4, 16, 16);
            }

            //Destroy Graphic Objects
            if (path != null)
            {
                path.Dispose();
            }
            if (BorderBrush != null)
            {
                BorderBrush.Dispose();
            }
            if (BorderPen != null)
            {
                BorderPen.Dispose();
            }
            if (BackgroundGradientBrush != null)
            {
                BackgroundGradientBrush.Dispose();
            }
            if (BackgroundBrush != null)
            {
                BackgroundBrush.Dispose();
            }
            if (TextColorBrush != null)
            {
                TextColorBrush.Dispose();
            }
            if (ShadowBrush != null)
            {
                ShadowBrush.Dispose();
            }
            if (ShadowPath != null)
            {
                ShadowPath.Dispose();
            }
        }
Ejemplo n.º 4
0
        public void Paint(IActor actor, IWorldCoordinate coord, string text)
        {
            if (!Enabled)
            {
                return;
            }
            if (Brush == null)
            {
                return;
            }
            if (Radius <= 0)
            {
                return;
            }
            if (!IsShownFunc.Invoke())
            {
                return;
            }

            var pct = FilledPercentFunc == null ? 100 : FilledPercentFunc.Invoke();

            using (var pg = Hud.Render.CreateGeometry())
            {
                using (var gs = pg.Open())
                {
                    var startAngleFull = 90f;
                    var endAngleFull   = 360f;
                    var fullAngleRange = endAngleFull - startAngleFull;
                    var halfRange      = fullAngleRange / 2f;
                    var angleStep      = fullAngleRange / 90f;

                    var start = Math.Max(startAngleFull, startAngleFull + halfRange * pct);
                    var end   = Math.Min(endAngleFull, endAngleFull - halfRange * pct);

                    if (start > end)
                    {
                        return;
                    }

                    var started = false;
                    for (var angle = start; angle <= end; angle += angleStep)
                    {
                        var radians = (angle - 180f) * Math.PI / 180.0f;
                        var cos     = (float)Math.Cos(radians);
                        var sin     = (float)Math.Sin(radians);
                        var mx      = Radius * cos;
                        var my      = Radius * sin;

                        var vector = actor.ToVector2(mx, my, 0);

                        if (started)
                        {
                            gs.AddLine(vector);
                        }
                        else
                        {
                            started = true;
                            gs.BeginFigure(vector, FigureBegin.Filled);
                        }
                    }

                    gs.EndFigure(FigureEnd.Open);
                    gs.Close();
                }

                if (ShadowBrush != null)
                {
                    ShadowBrush.DrawGeometry(pg);
                }

                Brush.DrawGeometry(pg);
            }
        }
Ejemplo n.º 5
0
        public void Draw(Graphics g)
        {
            g.SmoothingMode = SmoothingMode.AntiAlias;

            int ArcWidth  = this.C_RoundCorners * 2;
            int ArcHeight = this.C_RoundCorners * 2;
            int ArcX1     = Rect.Left;
            int ArcX2     = (this.ShadowControl) ? (Rect.Left + Rect.Width - (ArcWidth + 1)) - this.ShadowThickness : Rect.Left + Rect.Width - (ArcWidth + 1);
            int ArcY1     = Rect.Top;
            int ArcY2     = (this.ShadowControl) ? (Rect.Top + Rect.Height - (ArcHeight + 1)) - this.ShadowThickness : Rect.Top + Rect.Height - (ArcHeight + 1);

            System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
            System.Drawing.Brush BorderBrush           = new SolidBrush(Color.Orange);
            System.Drawing.Pen   BorderPen             = new Pen(BorderBrush, 2.0f);
            System.Drawing.Drawing2D.LinearGradientBrush BackgroundGradientBrush = null;
            System.Drawing.Brush                  BackgroundBrush = new SolidBrush(Color.White);
            System.Drawing.SolidBrush             ShadowBrush     = null;
            System.Drawing.Drawing2D.GraphicsPath ShadowPath      = null;

            //画出阴影效果
            if (this.ShadowControl)
            {
                Color shadowColor = Color.FromArgb(192, this.ShadowColor);
                //说明:1-(128/255)=1-0.5=0.5 透明度为0.5,即50%
                ShadowBrush = new SolidBrush(shadowColor);
                //ShadowBrush = new SolidBrush(this.ShadowColor);
                ShadowPath = new System.Drawing.Drawing2D.GraphicsPath();
                ShadowPath.AddArc(ArcX1 + this.ShadowThickness, ArcY1 + this.ShadowThickness, ArcWidth, ArcHeight, 180, SweepAngle); //顶端的左角
                ShadowPath.AddArc(ArcX2 + this.ShadowThickness, ArcY1 + this.ShadowThickness, ArcWidth, ArcHeight, 270, SweepAngle); //顶端右角
                ShadowPath.AddArc(ArcX2 + this.ShadowThickness, ArcY2 + this.ShadowThickness, ArcWidth, ArcHeight, 360, SweepAngle); //底部右角
                ShadowPath.AddArc(ArcX1 + this.ShadowThickness, ArcY2 + this.ShadowThickness, ArcWidth, ArcHeight, 90, SweepAngle);  //底部左角
                ShadowPath.CloseAllFigures();

                g.FillPath(ShadowBrush, ShadowPath);
            }

            //画出图形
            path.AddArc(ArcX1, ArcY1, ArcWidth, ArcHeight, 180, SweepAngle);
            path.AddArc(ArcX2, ArcY1, ArcWidth, ArcHeight, 270, SweepAngle);
            path.AddArc(ArcX2, ArcY2, ArcWidth, ArcHeight, 360, SweepAngle);
            path.AddArc(ArcX1, ArcY2, ArcWidth, ArcHeight, 90, SweepAngle);
            path.CloseAllFigures();

            if (this.C_BackgroundGradientMode == DutBoxGradientMode.None)
            {
                BackgroundBrush = new SolidBrush(this.BackgroundGradientColor);
                g.FillPath(BackgroundBrush, path);
            }
            else
            {
                Color startColor = Color.FromArgb(192, Color.White);
                BackgroundGradientBrush = new LinearGradientBrush(new Rectangle(Rect.Left, Rect.Top, Rect.Width, Rect.Height), startColor, this.BackgroundGradientColor, (LinearGradientMode)this.BackgroundGradientMode);

                g.FillPath(BackgroundGradientBrush, path);
            }
            //画边框
            if (Focus)
            {
                g.DrawPath(BorderPen, path);
            }
            else
            {
                System.Drawing.Brush defaultBrush = new SolidBrush(this.BorderColor);
                System.Drawing.Pen   defaultPen   = new Pen(defaultBrush, this.BorderThickness);
                g.DrawPath(defaultPen, path);

                if (defaultBrush != null)
                {
                    defaultBrush.Dispose();
                }
                if (defaultPen != null)
                {
                    defaultPen.Dispose();
                }
            }
            //画内容 ID
            Font font = new Font("Arial", 14.25F, System.Drawing.FontStyle.Bold);

            g.DrawString((ID + 1).ToString(), font, Brushes.Black, Rect.Left + 6, Rect.Top + 6);
            if (Connected)
            {
                //画状态
                if (!string.IsNullOrEmpty(Status))
                {
                    font = new Font("Arial", 11.25F, FontStyle.Bold);
                    g.DrawString(Status, font, Brushes.Black, Rect.Left + 6 + 56, Rect.Top + 6 + 2);
                }
                //画进度条

                Rectangle bar = new Rectangle(Rect.Left + 6, Rect.Top + 28, Rect.Width - 10, 14);
                ProgressBar.Rect = bar;
                g.SmoothingMode  = SmoothingMode.Default;
                ProgressBar.Draw(g);
                g.SmoothingMode = SmoothingMode.AntiAlias;

                /* Button but = new Button( );
                 * but.Text = "打印";
                 * but.Location = new Point(Rect.Width - 5,14);*/

                //画打印图标 20161223 bonnie
                string haarXmlPath = @"../../打印图标.png";

                FileInfo file     = new FileInfo(haarXmlPath);
                string   fullName = file.FullName;

                //画SN
                if (!string.IsNullOrEmpty(SerialNumber))
                {
                    font = new Font("Arial", 10.25F);
                    g.DrawString("SN:" + SerialNumber, font, Brushes.Black, Rect.Left + 6, Rect.Top + 6 + 40);
                }
                //画IMEI
                if (!string.IsNullOrEmpty(IMEI))
                {
                    font = new Font("Arial", 10.25F);
                    g.DrawString("IMEI:" + IMEI, font, Brushes.Black, Rect.Left + 6, Rect.Top + 6 + 60);
                }
                font = new Font("Arial", 10.25F, FontStyle.Bold);
                //画time
                if (ElapsedTime > 0.0f)
                {
                    g.DrawString((int)ElapsedTime + "/" + (int)EstimateTime, font, Brushes.Black, Rect.Left + 6, Rect.Top + 6 + 80);
                }
                //画测试方式
                switch (Way)
                {
                case TestWay.TW_AUTO:
                    g.DrawString("Auto", font, Brushes.DarkGreen, Rect.Left + 6 + 90, Rect.Top + 6 + 80);
                    break;

                case TestWay.TW_MANUAL:
                    g.DrawString("Manual", font, Brushes.Red, Rect.Left + 6 + 80, Rect.Top + 6 + 80);
                    break;

                case TestWay.TW_NONE:
                    break;
                }
                //画Model
                if (!string.IsNullOrEmpty(Model))
                {
                    font = new Font("Arial", 10.25F);
                    g.DrawString(Model, font, Brushes.Black, Rect.Left + 6, Rect.Top + 6 + 100);
                }
                //画QRCode 48 x 48
                if (QRCode != null)
                {
                    bar = new Rectangle(Rect.Right - 58, Rect.Top + 84, 48, 48);
                    //g.FillRectangle(Brushes.Red, bar);
                    g.SmoothingMode = SmoothingMode.None;
                    g.DrawImageUnscaled(QRCode, bar);
                    g.SmoothingMode = SmoothingMode.AntiAlias;
                }

                if (QRCode != null)
                {
                    FileInfo image_file = new FileInfo($@"./pictures/打印图标.png");
                    if (image_file.Exists)
                    {
                        PrintIocnImage  = Image.FromFile(image_file.FullName);
                        g.SmoothingMode = SmoothingMode.None;
                        g.DrawImage(PrintIocnImage, Rect.Right - 98, Rect.Top + 104);
                        g.SmoothingMode = SmoothingMode.AntiAlias;
                    }
                }
            }
            else // disconnected - TESTING & FAIL
            {
                if (Result == ItemResult.IR_TESTING)
                {
                    StringFormat stringFormat = new StringFormat();
                    stringFormat.LineAlignment = StringAlignment.Center;
                    stringFormat.Alignment     = StringAlignment.Center;
                    stringFormat.FormatFlags   = StringFormatFlags.LineLimit;
                    stringFormat.Trimming      = StringTrimming.EllipsisCharacter;
                    font = new Font("Arial", 16.25F, FontStyle.Bold);

                    g.DrawString("OFFLINE", font, Brushes.White, Rect, stringFormat);
                }
            }
            //画对号
            if (Checked)
            {
                //g.DrawLine(BorderPen, 10, 10, 20, 20);
                int x   = Rect.Left + Rect.Width - 30;
                int y   = Rect.Top + 8;
                Pen pen = new Pen(new SolidBrush(Color.DarkOrange), this.BorderThickness);
                for (int i = 0; i < 6; i++)
                {
                    g.DrawLine(pen, x, y, x, y + 6);
                    x++; y++;
                }
                for (int i = 0; i < 11; i++)
                {
                    g.DrawLine(pen, x, y, x, y + 6);
                    x++; y--;
                }
                if (pen != null)
                {
                    pen.Dispose();
                }
            }
            //销毁Graphic 对象
            if (path != null)
            {
                path.Dispose();
            }
            if (BorderBrush != null)
            {
                BorderPen.Dispose();
            }
            if (BorderPen != null)
            {
                BorderPen.Dispose();
            }

            if (BackgroundGradientBrush != null)
            {
                BackgroundGradientBrush.Dispose();
            }
            if (BackgroundBrush != null)
            {
                BackgroundBrush.Dispose();
            }
            if (ShadowBrush != null)
            {
                ShadowBrush.Dispose();
            }
            if (ShadowPath != null)
            {
                ShadowPath.Dispose();
            }
        }
Ejemplo n.º 6
0
        private void DrawBackground(System.Drawing.Graphics g)
        {
            //Graphics g = bg.Graphics;
            g.SmoothingMode = SmoothingMode.AntiAlias;

            int ArcWidth  = this.C_RoundCorners * 2;
            int ArcHeight = this.C_RoundCorners * 2;
            int ArcX1     = 0;
            int ArcX2     = (this.ShadowControl) ? (this.Width - (ArcWidth + 1)) - this.ShadowThickness : this.Width - (ArcWidth + 1);
            int ArcY1     = 0;
            int ArcY2     = (this.ShadowControl) ? (this.Height - (ArcHeight + 1)) - this.ShadowThickness : this.Height - (ArcHeight + 1);

            System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
            System.Drawing.Brush BorderBrush           = new SolidBrush(_colorFrame);        //this.BorderColor
            System.Drawing.Pen   BorderPen             = new Pen(BorderBrush, _frameBorder); //this.BorderThickness
            System.Drawing.Drawing2D.LinearGradientBrush BackgroundGradientBrush = null;
            System.Drawing.Brush                  BackgroundBrush = new SolidBrush(this.BackgroundColor);
            System.Drawing.SolidBrush             ShadowBrush     = null;
            System.Drawing.Drawing2D.GraphicsPath ShadowPath      = null;

            //画出阴影效果
            if (this.ShadowControl)
            {
                ShadowBrush = new SolidBrush(this.ShadowColor);
                ShadowPath  = new System.Drawing.Drawing2D.GraphicsPath();
                ShadowPath.AddArc(ArcX1 + this.ShadowThickness, ArcY1 + this.ShadowThickness, ArcWidth, ArcHeight, 180, SweepAngle); //顶端的左角
                ShadowPath.AddArc(ArcX2 + this.ShadowThickness, ArcY1 + this.ShadowThickness, ArcWidth, ArcHeight, 270, SweepAngle); //顶端右角
                ShadowPath.AddArc(ArcX2 + this.ShadowThickness, ArcY2 + this.ShadowThickness, ArcWidth, ArcHeight, 360, SweepAngle); //底部右角
                ShadowPath.AddArc(ArcX1 + this.ShadowThickness, ArcY2 + this.ShadowThickness, ArcWidth, ArcHeight, 90, SweepAngle);  //底部左角
                ShadowPath.CloseAllFigures();

                g.FillPath(ShadowBrush, ShadowPath);
            }

            //画出图形
            path.AddArc(ArcX1, ArcY1, ArcWidth, ArcHeight, 180, SweepAngle);
            path.AddArc(ArcX2, ArcY1, ArcWidth, ArcHeight, 270, SweepAngle);
            path.AddArc(ArcX2, ArcY2, ArcWidth, ArcHeight, 360, SweepAngle);
            path.AddArc(ArcX1, ArcY2, ArcWidth, ArcHeight, 90, SweepAngle);
            path.CloseAllFigures();

            if (this.C_BackgroundGradientMode == DutBoxGradientMode.None)
            {
                g.FillPath(BackgroundBrush, path);
            }
            else
            {
                BackgroundGradientBrush = new LinearGradientBrush(new Rectangle(0, 0, this.Width, this.Height), this.BackgroundColor, this.BackgroundGradientColor, (LinearGradientMode)this.BackgroundGradientMode);

                g.FillPath(BackgroundGradientBrush, path);
            }
            //画对号
            if (IsActivedDut && ManualChecked)
            {
                //g.DrawLine(BorderPen, 10, 10, 20, 20);
                int x = Width - 30;
                int y = 12;

                /*
                 * x--; y++;
                 * g.DrawLine(pen, x, y, x, y + 4);
                 * x--; y++;
                 * g.DrawLine(pen, x, y, x, y + 2);
                 * x--; y++;
                 * x = Width - 30;
                 * y = 12;
                 * */
                for (int i = 0; i < 6; i++)
                {
                    g.DrawLine(CheckedPen, x, y, x, y + 6);
                    x++; y++;
                }
                for (int i = 0; i < 12; i++)
                {
                    g.DrawLine(CheckedPen, x, y, x, y + 6);
                    x++; y--;
                }

                /*
                 * g.DrawLine(pen, x, y + 2, x, y + 6);
                 * x++; y++;
                 * g.DrawLine(pen, x, y + 2, x, y + 4);
                 * x++; y++;
                 * */
            }
            //画边框
            if (IsActivedDut)
            {
                g.DrawPath(BorderPen, path);
            }
            else
            {
                System.Drawing.Brush defaultBrush = new SolidBrush(this.BorderColor);
                System.Drawing.Pen   defaultPen   = new Pen(defaultBrush, this.BorderThickness);
                g.DrawPath(defaultPen, path);
            }
            //销毁Graphic 对象
            if (path != null)
            {
                path.Dispose();
            }
            if (BorderBrush != null)
            {
                BorderPen.Dispose();
            }
            if (BorderPen != null)
            {
                BorderPen.Dispose();
            }

            if (BackgroundGradientBrush != null)
            {
                BackgroundGradientBrush.Dispose();
            }
            if (BackgroundBrush != null)
            {
                BackgroundBrush.Dispose();
            }
            if (ShadowBrush != null)
            {
                ShadowBrush.Dispose();
            }
            if (ShadowPath != null)
            {
                ShadowPath.Dispose();
            }
        }
Ejemplo n.º 7
0
        /// <summary>This method will paint the control.</summary>
        /// <param name="g">The paint event graphics object.</param>
        private void PaintBack(System.Drawing.Graphics g)
        {
            //Set Graphics smoothing mode to Anit-Alias--
            g.SmoothingMode = SmoothingMode.AntiAlias;
            //-------------------------------------------

            //Declare Variables------------------
            int ArcWidth  = this.RoundCorners * 2;
            int ArcHeight = this.RoundCorners * 2;
            int ArcX1     = 0;
            int ArcX2     = (this.ShadowControl) ? (this.Width - (ArcWidth + 1)) - this.ShadowThickness : this.Width - (ArcWidth + 1);
            int ArcY1     = 10;
            int ArcY2     = (this.ShadowControl) ? (this.Height - (ArcHeight + 1)) - this.ShadowThickness : this.Height - (ArcHeight + 1);

            int intXEnd = 20;

            if (GroupBoxAlignMode.Center == this._vGroupBoxAlignMode)
            {
                intXEnd += _vXTrans;
            }
            else if (GroupBoxAlignMode.Right == this._vGroupBoxAlignMode)
            {
                intXEnd += _vXTrans * 2;
            }
            int intTextLength = g.MeasureString(this.GroupTitle, this.Font).ToSize().Width + 34 - (ArcWidth + 1) - 20;
            int intXStart     = intXEnd + intTextLength + ArcWidth;
            int X1            = intXEnd;
            int X2            = intXStart;

            if (this.GroupImage != null)
            {
                if (this.ShowTileRectangle)
                {
                    X2 += 18;
                }
                else
                {
                    X2 += 10;
                }
            }
            else
            {
                if (!this.ShowTileRectangle)
                {
                    X1 += 8 - this.TextLineSpace;
                    X2 -= 8 - this.TextLineSpace;
                }
            }
            X1 -= this.TitleLeftSpace;
            X2 -= this.TitleLeftSpace;

            System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
            System.Drawing.Brush BorderBrush           = new SolidBrush(this.BorderColor);
            System.Drawing.Pen   BorderPen             = new Pen(BorderBrush, this.BorderThickness);
            System.Drawing.Drawing2D.LinearGradientBrush BackgroundGradientBrush = null;
            System.Drawing.Brush                  BackgroundBrush = new SolidBrush(this.BackgroundColor);
            System.Drawing.SolidBrush             ShadowBrush     = null;
            System.Drawing.Drawing2D.GraphicsPath ShadowPath      = null;
            //-----------------------------------

            //Check if shadow is needed----------
            if (this.ShadowControl)
            {
                ShadowBrush = new SolidBrush(this.ShadowColor);
                ShadowPath  = new System.Drawing.Drawing2D.GraphicsPath();
                ShadowPath.AddArc(ArcX1 + this.ShadowThickness, ArcY1 + this.ShadowThickness, ArcWidth, ArcHeight, 180, GroupBoxConstants.SweepAngle); // Top Left
                ShadowPath.AddArc(ArcX2 + this.ShadowThickness, ArcY1 + this.ShadowThickness, ArcWidth, ArcHeight, 270, GroupBoxConstants.SweepAngle); //Top Right
                ShadowPath.AddArc(ArcX2 + this.ShadowThickness, ArcY2 + this.ShadowThickness, ArcWidth, ArcHeight, 360, GroupBoxConstants.SweepAngle); //Bottom Right
                ShadowPath.AddArc(ArcX1 + this.ShadowThickness, ArcY2 + this.ShadowThickness, ArcWidth, ArcHeight, 90, GroupBoxConstants.SweepAngle);  //Bottom Left
                ShadowPath.CloseAllFigures();

                //Paint Rounded Rectangle------------
                g.FillPath(ShadowBrush, ShadowPath);
                //-----------------------------------
            }
            //-----------------------------------
            //Edit BY WZW 2008-12-16
            //Create Rounded Rectangle Path------
            //path.AddArc(ArcX1, ArcY1, ArcWidth, ArcHeight, 180, GroupBoxConstants.SweepAngle); // Top Left
            //path.AddArc(ArcX2, ArcY1, ArcWidth, ArcHeight, 270, GroupBoxConstants.SweepAngle); //Top Right
            //path.AddArc(ArcX2, ArcY2, ArcWidth, ArcHeight, 360, GroupBoxConstants.SweepAngle); //Bottom Right
            //path.AddArc(ArcX1, ArcY2, ArcWidth, ArcHeight, 90, GroupBoxConstants.SweepAngle); //Bottom Left
            //path.CloseAllFigures();
            //g.DrawPath(BorderPen, path);
            //-----------------------------------
            //g.DrawArc(ArcX1, ArcY1, ArcWidth, ArcHeight, 180, GroupBoxConstants.SweepAngle);

            //绘制标题外边框-----------------------


            //左上角
            g.DrawArc(BorderPen, ArcX1, ArcY1, ArcWidth, ArcHeight, 180, GroupBoxConstants.SweepAngle);
            //左上至右上分两段画线,两段之间为标题外框
            BorderPen = new Pen(BorderBrush, this.BorderThickness);
            g.DrawLine(BorderPen, new Point(ArcX1 + this.RoundCorners, ArcY1), new Point(X1, ArcY1)); //左边一段直线
            BorderPen = new Pen(BorderBrush, this.BorderThickness);
            g.DrawLine(BorderPen, new Point(X2, ArcY1), new Point(ArcX2 + this.RoundCorners, ArcY1)); //右边一段直线

            //右上角
            g.DrawArc(BorderPen, ArcX2, ArcY1, ArcWidth, ArcHeight, 270, GroupBoxConstants.SweepAngle);

            if (!_vBorderTopOnly)
            {
                //右上至右下
                g.DrawLine(BorderPen, new Point(ArcX2 + ArcWidth, ArcY1 + this.RoundCorners), new Point(ArcX2 + ArcHeight, ArcY2 + this.RoundCorners));
                //右下角

                g.DrawArc(BorderPen, ArcX2, ArcY2, ArcWidth, ArcHeight, 360, GroupBoxConstants.SweepAngle);
                //右下至左下

                g.DrawLine(BorderPen, new Point(ArcX2 + this.RoundCorners, ArcY2 + ArcWidth), new Point(ArcX1 + this.RoundCorners, ArcY2 + ArcWidth));
                //左下角
                g.DrawArc(BorderPen, ArcX1, ArcY2, ArcWidth, ArcHeight, 90, GroupBoxConstants.SweepAngle);
                //左下只左上
                g.DrawLine(BorderPen, new Point(ArcX1, ArcY2 + this.RoundCorners), new Point(ArcX1, ArcY1 + this.RoundCorners));
                //g.DrawPath(BorderPen, path);
            }

            //Check if Gradient Mode is enabled--
            if (this.BackgroundGradientMode == GroupBoxGradientMode.None)
            {
                //Paint Rounded Rectangle------------
                g.FillPath(BackgroundBrush, path);
                //-----------------------------------
            }
            else
            {
                BackgroundGradientBrush = new LinearGradientBrush(new Rectangle(0, 0, this.Width, this.Height), this.BackgroundColor, this.BackgroundGradientColor, (LinearGradientMode)this.BackgroundGradientMode);

                //Paint Rounded Rectangle------------
                g.FillPath(BackgroundGradientBrush, path);
                //-----------------------------------
            }
            //-----------------------------------

            //Delete BY WZW
            //Paint Borded-----------------------
            //g.DrawPath(BorderPen, path);
            //g.DrawLine(SystemPens.Control, 10, 10, 100, 10);
            //-----------------------------------

            //Destroy Graphic Objects------------
            if (path != null)
            {
                path.Dispose();
            }
            if (BorderBrush != null)
            {
                BorderBrush.Dispose();
            }
            if (BorderPen != null)
            {
                BorderPen.Dispose();
            }
            if (BackgroundGradientBrush != null)
            {
                BackgroundGradientBrush.Dispose();
            }
            if (BackgroundBrush != null)
            {
                BackgroundBrush.Dispose();
            }
            if (ShadowBrush != null)
            {
                ShadowBrush.Dispose();
            }
            if (ShadowPath != null)
            {
                ShadowPath.Dispose();
            }
            //-----------------------------------
        }
Ejemplo n.º 8
0
        /// <summary>This method will paint the group title.</summary>
        /// <param name="g">The paint event graphics object.</param>
        private void PaintGroupText(System.Drawing.Graphics g)
        {
            //Check if string has something-------------
            if (this.GroupTitle == string.Empty)
            {
                return;
            }
            //------------------------------------------

            //Set Graphics smoothing mode to Anit-Alias--
            g.SmoothingMode = SmoothingMode.AntiAlias;
            //-------------------------------------------

            //Declare Variables------------------
            SizeF stringSize  = g.MeasureString(this.GroupTitle, this.Font);
            Size  stringSize2 = stringSize.ToSize();


            if (this.GroupImage != null)
            {
                stringSize2.Width += 18;
            }
            //int ArcWidth = this.RoundCorners;
            //int ArcHeight = this.RoundCorners;
            int arcWidth  = this.HeaderRoundCorners;
            int arcHeight = this.HeaderRoundCorners;
            //int intX1 = 0;
            //int intX2 = 0;

            //int ArcX1 = 10;
            //int ArcX2 = (StringSize2.Width + 34) - (ArcWidth + 1);
            int ArcX1 = 20;
            int ArcX2 = (stringSize2.Width + 34) - (arcWidth + 1);
            int ArcY1 = 2;
            int ArcY2 = 22 - (arcHeight + 1);

            //Add by WZW 2008-12-16 增加GroupTitleBox对齐方式 ===Start
            int intMidX           = this.Size.Width / 2;
            int intMidX1          = (ArcX2 - ArcX1) / 2;
            int CustomStringWidth = (this.GroupImage != null) ? 44 : 28;

            _vXTrans = intMidX - intMidX1 - ArcX1;//X坐标平移距离
            int intTitleTextSpace = CustomStringWidth - ArcX1;

            //中间对齐
            if (this._vGroupBoxAlignMode == GroupBoxAlignMode.Center)
            {
                ArcX1             = intMidX - intMidX1;
                ArcX2             = intMidX + intMidX1;
                CustomStringWidth = ArcX1 + intTitleTextSpace;
            }
            else if (this._vGroupBoxAlignMode == GroupBoxAlignMode.Right)
            {
                ArcX1             = intMidX + intMidX - ArcX2;
                ArcX2             = ArcX1 + intMidX1 + intMidX1;
                CustomStringWidth = ArcX1 + intTitleTextSpace;
            }
            //标题与左边线距离
            ArcX1 -= this.TitleLeftSpace;
            ArcX2 -= this.TitleLeftSpace;

            //Add by WZW 2008-12-16 增加GroupTitleBox对齐方式 ===End
            System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
            System.Drawing.Brush BorderBrush           = new SolidBrush(this.BorderColor);
            System.Drawing.Pen   BorderPen             = new Pen(BorderBrush, this.BorderThickness);
            System.Drawing.Drawing2D.LinearGradientBrush BackgroundGradientBrush = null;
            System.Drawing.Brush                  BackgroundBrush = (this.PaintGroupBox) ? new SolidBrush(this.CustomGroupBoxColor) : new SolidBrush(this.BackgroundColor);
            System.Drawing.SolidBrush             TextColorBrush  = new SolidBrush(this.ForeColor);
            System.Drawing.SolidBrush             ShadowBrush     = null;
            System.Drawing.Drawing2D.GraphicsPath ShadowPath      = null;
            //-----------------------------------

            //Check if shadow is needed----------
            if (this.ShadowControl)
            {
                ShadowBrush = new SolidBrush(this.ShadowColor);
                ShadowPath  = new System.Drawing.Drawing2D.GraphicsPath();
                ShadowPath.AddArc(ArcX1 + (this.ShadowThickness - 1), ArcY1 + (this.ShadowThickness - 1), arcWidth, arcHeight, 180, GroupBoxConstants.SweepAngle); // Top Left
                ShadowPath.AddArc(ArcX2 + (this.ShadowThickness - 1), ArcY1 + (this.ShadowThickness - 1), arcWidth, arcHeight, 270, GroupBoxConstants.SweepAngle); //Top Right
                ShadowPath.AddArc(ArcX2 + (this.ShadowThickness - 1), ArcY2 + (this.ShadowThickness - 1), arcWidth, arcHeight, 360, GroupBoxConstants.SweepAngle); //Bottom Right
                ShadowPath.AddArc(ArcX1 + (this.ShadowThickness - 1), ArcY2 + (this.ShadowThickness - 1), arcWidth, arcHeight, 90, GroupBoxConstants.SweepAngle);  //Bottom Left
                ShadowPath.CloseAllFigures();

                //Paint Rounded Rectangle------------
                g.FillPath(new SolidBrush(Color.Transparent), ShadowPath);
                //g.FillPath(ShadowBrush, ShadowPath);
                //-----------------------------------
            }
            //-----------------------------------
            //Edit BY WZW 2008-12-16
            //是否显示标题边框------
            if (this._vShowTileRectangle)
            {
                //创建title边框路径
                path.AddArc(ArcX1, ArcY1, arcWidth, arcHeight, 180, GroupBoxConstants.SweepAngle); // Top Left
                path.AddArc(ArcX2, ArcY1, arcWidth, arcHeight, 270, GroupBoxConstants.SweepAngle); //Top Right
                path.AddArc(ArcX2, ArcY2, arcWidth, arcHeight, 360, GroupBoxConstants.SweepAngle); //Bottom Right
                path.AddArc(ArcX1, ArcY2, arcWidth, arcHeight, 90, GroupBoxConstants.SweepAngle);  //Bottom Left
                path.CloseAllFigures();
                //画Title边框
                g.DrawPath(BorderPen, path);
            }

            //-----------------------------------

            //Check if Gradient Mode is enabled--
            if (this.PaintGroupBox)
            {
                //Paint Rounded Rectangle------------
                g.FillPath(BackgroundBrush, path);
                //-----------------------------------
            }
            else
            {
                if (this.BackgroundGradientMode == GroupBoxGradientMode.None)
                {
                    //Paint Rounded Rectangle------------
                    g.FillPath(BackgroundBrush, path);
                    //-----------------------------------
                }
                else
                {
                    BackgroundGradientBrush = new LinearGradientBrush(new Rectangle(0, 0, this.Width, this.Height), this.BackgroundColor, this.BackgroundGradientColor, (LinearGradientMode)this.BackgroundGradientMode);

                    //Paint Rounded Rectangle------------
                    g.FillPath(BackgroundGradientBrush, path);
                    //-----------------------------------
                }
            }
            //-----------------------------------

            //绘制title文字-------------------------
            //int CustomStringWidth = (this.GroupImage != null) ? 44 : 28;
            //if(this.GroupImage!=null)
            //{
            //    CustomStringWidth += 2;
            //}

            //g.DrawString(this.GroupTitle, this.Font, TextColorBrush, CustomStringWidth, 5);

            // g.DrawString(this.GroupTitle, this.Font, TextColorBrush, CustomStringWidth-this.TitleLeftSpace-2, 5);
            g.DrawString(this.GroupTitle, this.Font, TextColorBrush, CustomStringWidth - this.TitleLeftSpace, 5);
            //-----------------------------------

            //Draw GroupImage if there is one----
            if (this.GroupImage != null)
            {
                //因增加了标题对齐功能,需修改X坐标值 By  WZW 2008-12-17
                g.DrawImage(this.GroupImage, ArcX1 + 5, 4, 16, 16);
            }

            //释放资源------------
            if (path != null)
            {
                path.Dispose();
            }
            if (BorderBrush != null)
            {
                BorderBrush.Dispose();
            }
            if (BorderPen != null)
            {
                BorderPen.Dispose();
            }
            if (BackgroundGradientBrush != null)
            {
                BackgroundGradientBrush.Dispose();
            }
            if (BackgroundBrush != null)
            {
                BackgroundBrush.Dispose();
            }
            if (TextColorBrush != null)
            {
                TextColorBrush.Dispose();
            }
            if (ShadowBrush != null)
            {
                ShadowBrush.Dispose();
            }
            if (ShadowPath != null)
            {
                ShadowPath.Dispose();
            }
        }
Ejemplo n.º 9
0
        /// <summary>This method will paint the group title.</summary>
        /// <param name="g">The paint event graphics object.</param>
        private void PaintGroupText(Graphics g)
        {
            //Check if string has something-------------
            if (GroupTitle == string.Empty)
            {
                return;
            }
            //------------------------------------------

            //Set Graphics smoothing mode to Anit-Alias--
            g.SmoothingMode = SmoothingMode.AntiAlias;
            //-------------------------------------------

            //Declare Variables------------------
            var StringSize  = g.MeasureString(GroupTitle, Font);
            var StringSize2 = StringSize.ToSize();

            if (GroupImage != null)
            {
                StringSize2.Width += 18;
            }
            var   ArcWidth    = RoundCorners;
            var   ArcHeight   = RoundCorners;
            var   ArcX1       = 20;
            var   ArcX2       = StringSize2.Width + 34 - (ArcWidth + 1);
            var   ArcY1       = 0;
            var   ArcY2       = 24 - (ArcHeight + 1);
            var   path        = new GraphicsPath();
            Brush BorderBrush = new SolidBrush(BorderColor);
            var   BorderPen   = new Pen(BorderBrush, BorderThickness);
            LinearGradientBrush BackgroundGradientBrush = null;
            Brush BackgroundBrush = PaintGroupBox
                ? new SolidBrush(CustomGroupBoxColor)
                : new SolidBrush(BackgroundColor);
            var          TextColorBrush = new SolidBrush(ForeColor);
            SolidBrush   ShadowBrush    = null;
            GraphicsPath ShadowPath     = null;

            //-----------------------------------

            //Check if shadow is needed----------
            if (ShadowControl)
            {
                ShadowBrush = new SolidBrush(ShadowColor);
                ShadowPath  = new GraphicsPath();
                ShadowPath.AddArc(
                    ArcX1 + (ShadowThickness - 1),
                    ArcY1 + (ShadowThickness - 1),
                    ArcWidth,
                    ArcHeight,
                    180,
                    GroupBoxConstants.SweepAngle); // TopCount Left
                ShadowPath.AddArc(
                    ArcX2 + (ShadowThickness - 1),
                    ArcY1 + (ShadowThickness - 1),
                    ArcWidth,
                    ArcHeight,
                    270,
                    GroupBoxConstants.SweepAngle); //TopCount Right
                ShadowPath.AddArc(
                    ArcX2 + (ShadowThickness - 1),
                    ArcY2 + (ShadowThickness - 1),
                    ArcWidth,
                    ArcHeight,
                    360,
                    GroupBoxConstants.SweepAngle); //Bottom Right
                ShadowPath.AddArc(ArcX1 + (ShadowThickness - 1), ArcY2 + (ShadowThickness - 1), ArcWidth, ArcHeight, 90,
                                  GroupBoxConstants.SweepAngle);
                //Bottom Left
                ShadowPath.CloseAllFigures();

                //Paint Rounded Rectangle------------
                g.FillPath(ShadowBrush, ShadowPath);
                //-----------------------------------
            }
            //-----------------------------------

            //Create Rounded Rectangle Path------
            path.AddArc(ArcX1, ArcY1, ArcWidth, ArcHeight, 180, GroupBoxConstants.SweepAngle); // TopCount Left
            path.AddArc(ArcX2, ArcY1, ArcWidth, ArcHeight, 270, GroupBoxConstants.SweepAngle); //TopCount Right
            path.AddArc(ArcX2, ArcY2, ArcWidth, ArcHeight, 360, GroupBoxConstants.SweepAngle); //Bottom Right
            path.AddArc(ArcX1, ArcY2, ArcWidth, ArcHeight, 90, GroupBoxConstants.SweepAngle);  //Bottom Left
            path.CloseAllFigures();
            //-----------------------------------

            //Check if Gradient Mode is enabled--
            if (PaintGroupBox)
            {
                //Paint Rounded Rectangle------------
                g.FillPath(BackgroundBrush, path);
                //-----------------------------------
            }
            else
            {
                if (BackgroundGradientMode == GroupBoxGradientMode.None)
                {
                    //Paint Rounded Rectangle------------
                    g.FillPath(BackgroundBrush, path);
                    //-----------------------------------
                }
                else
                {
                    BackgroundGradientBrush = new LinearGradientBrush(
                        new Rectangle(0, 0, Width, Height),
                        BackgroundColor,
                        BackgroundGradientColor,
                        (LinearGradientMode)BackgroundGradientMode);

                    //Paint Rounded Rectangle------------
                    g.FillPath(BackgroundGradientBrush, path);
                    //-----------------------------------
                }
            }
            //-----------------------------------

            //Paint Borded-----------------------
            g.DrawPath(BorderPen, path);
            //-----------------------------------

            //Paint Text-------------------------
            var CustomStringWidth = GroupImage != null ? 44 : 28;

            g.DrawString(GroupTitle, Font, TextColorBrush, CustomStringWidth, 5);
            //-----------------------------------

            //Draw GroupImage if there is one----
            if (GroupImage != null)
            {
                g.DrawImage(GroupImage, 28, 4, 16, 16);
            }
            //-----------------------------------

            //Destroy Graphic Objects------------
            if (path != null)
            {
                path.Dispose();
            }
            if (BorderBrush != null)
            {
                BorderBrush.Dispose();
            }
            if (BorderPen != null)
            {
                BorderPen.Dispose();
            }
            if (BackgroundGradientBrush != null)
            {
                BackgroundGradientBrush.Dispose();
            }
            if (BackgroundBrush != null)
            {
                BackgroundBrush.Dispose();
            }
            if (TextColorBrush != null)
            {
                TextColorBrush.Dispose();
            }
            if (ShadowBrush != null)
            {
                ShadowBrush.Dispose();
            }
            if (ShadowPath != null)
            {
                ShadowPath.Dispose();
            }

            //-----------------------------------
        }
        public void PaintTopInGame(ClipState clipState)
        //public void PaintWorld(WorldLayer layer)
        {
            if (!ShowTracker)
            {
                return;
            }

            var h = Hud.Window.Size.Height * 0.001667f * BarHeight;          //8
            var w = Hud.Window.Size.Width * 0.00155f * BarWidth;             //55

            if (PositionX == -1 || PositionY == -1)
            {
                var objectivesPosition = Hud.Render.GetUiElement("Root.NormalLayer.eventtext_bkgrnd.eventtext_region.title").Rectangle;
                PositionX = objectivesPosition.X - ProcRuleCalculator.StandardIconSize - Gap; // Hud.Render.MinimapUiElement.Rectangle.X - Gap*2 - w - Gap - ProcRuleCalculator.StandardIconSize; //left of the minimap
                PositionY = objectivesPosition.Y;                                             //Hud.Window.Size.Height * 0.015f; //0.14f;
            }

            var x = PositionX;
            var y = PositionY;

            IEnumerable <KeyValuePair <uint, ProcInfo> > ActiveSnapshots = Snapshots.Where(kvp => kvp.Value.FinishTick > Hud.Game.CurrentGameTick);

            //draw background
            int active = ActiveSnapshots.Count();

            if (active > 0)
            {
                ShadowBrush.Opacity = 0.25f;
                ShadowBrush.DrawRectangle(x + ProcRuleCalculator.StandardIconSize, y, w + Gap * 2 + BorderBrush.StrokeWidth, active * (ProcRuleCalculator.StandardIconSize + Gap) - Gap);
            }

            //draw countdowns
            foreach (KeyValuePair <uint, ProcInfo> entry in ActiveSnapshots)
            {
                //render the proc snapshot if it is not expired
                ProcInfo snapshot = entry.Value;
                float    timeLeft = (float)(snapshot.FinishTick - Hud.Game.CurrentGameTick) / 60f;              //seconds
                float    w2       = (float)(timeLeft * w / snapshot.Duration);
                float    opacity  = (timeLeft >= 1 || (timeLeft < 1 && (Hud.Game.CurrentRealTimeMilliseconds / 200) % 2 == 0) ? 0.9f : 0.2f);

                snapshot.Texture.Draw(x, y, ProcRuleCalculator.StandardIconSize, ProcRuleCalculator.StandardIconSize, opacity);                 //draw custom icon
                BorderBrush.DrawRectangle(x + 1, y + 1, ProcRuleCalculator.StandardIconSize - 2, ProcRuleCalculator.StandardIconSize - 2);      //draw custom border

                float x2 = x + ProcRuleCalculator.StandardIconSize + Gap + BorderBrush.StrokeWidth;
                float y2 = y + ProcRuleCalculator.StandardIconSize * 0.5f - h * 0.5f;

                ShadowBrush.Opacity = 0.25f;
                ShadowBrush.DrawRectangle(x2 - 4, y2 - 4, w + 8, h + 8);

                IBrush brush;
                if (!ProcBrush.TryGetValue(snapshot.PlayerClass, out brush))
                {
                    brush = ProcBrushDefault;
                }

                brush.DrawRectangle(x2, y2, w2, h);
                BorderBrush.DrawRectangle(x2 - 2, y2 - 2, w + 4, h + 4);

                //draw countdown text
                TextLayout layout = TimeLeftFont.GetTextLayout(timeLeft.ToString(timeLeft > 1 ? "F0" : "F1"));
                TimeLeftFont.DrawText(layout, x2 + w * 0.5f - layout.Metrics.Width * 0.5f, y2 + h * 0.5f - layout.Metrics.Height * 0.5f);

                //draw player name
                layout = PlayerFont.GetTextLayout(snapshot.PlayerName);
                PlayerFont.DrawText(layout, x - layout.Metrics.Width - Gap, y + ProcRuleCalculator.StandardIconSize * 0.5f - layout.Metrics.Height * 0.5f);

                y += ProcRuleCalculator.StandardIconSize + Gap;
            }             //end foreach
        } //end PaintTopInGame