/// <summary>
        /// 画空间体
        /// </summary>
        /// <param name="Gr"></param>
        /// <param name="rc"></param>
        /// <returns></returns>
        public virtual bool DrawKnob(Graphics Gr, RectangleF rc)
        {
            if (this.Knob == null)
            {
                return(false);
            }

            Color cKnob     = this.Knob.KnobColor;
            Color cKnobDark = HMIColorManager.StepColor(cKnob, 60);

            LinearGradientBrush br = new LinearGradientBrush(rc, cKnob, cKnobDark, 45);

            Gr.FillEllipse(br, rc);

            if (this.Knob.State == HMIKnob.ButtonState.Pressed)
            {
                RectangleF _rc = rc;
                _rc.Inflate(-15F * this.drawRatio, -15F * drawRatio);
                LinearGradientBrush br2 = new LinearGradientBrush(_rc,
                                                                  cKnobDark,
                                                                  cKnob,
                                                                  45);
                Gr.FillEllipse(br2, _rc);
                br2.Dispose();
            }

            br.Dispose();

            return(true);
        }
Example #2
0
        /// <summary>
        /// 画表盘
        /// </summary>
        /// <param name="Gr"></param>
        /// <param name="rc"></param>
        /// <returns></returns>
        public virtual bool DrawBody(Graphics Gr, RectangleF rc)
        {
            if (this.AnalogMeter == null)
            {
                return(false);
            }

            Color bodyColor = this.AnalogMeter.BodyColor;
            Color cDark     = HMIColorManager.StepColor(bodyColor, 20);

            LinearGradientBrush br1 = new LinearGradientBrush(rc,
                                                              bodyColor,
                                                              cDark,
                                                              45);

            Gr.FillEllipse(br1, rc);

            RectangleF _rc = rc;

            _rc.X      += 3 * drawRatio;
            _rc.Y      += 3 * drawRatio;
            _rc.Width  -= 6 * drawRatio;
            _rc.Height -= 6 * drawRatio;

            LinearGradientBrush br2 = new LinearGradientBrush(_rc,
                                                              cDark,
                                                              bodyColor,
                                                              45);

            Gr.FillEllipse(br2, _rc);

            br1.Dispose();
            br2.Dispose();
            return(true);
        }
        /// <summary>
        /// 画控件实体
        /// </summary>
        /// <param name="Gr"></param>
        /// <param name="rc"></param>
        /// <returns></returns>
        public virtual bool DrawBody(Graphics Gr, RectangleF rc)
        {
            if (this.Button == null)
            {
                return(false);
            }

            Color bodyColor = this.Button.ButtonColor;
            Color cDark     = HMIColorManager.StepColor(bodyColor, 20);

            LinearGradientBrush br1 = new LinearGradientBrush(rc,
                                                              bodyColor,
                                                              cDark,
                                                              45);

            if ((this.Button.Style == HMIButton.ButtonStyle.Circular) ||
                (this.Button.Style == HMIButton.ButtonStyle.Elliptical))
            {
                Gr.FillEllipse(br1, rc);
            }
            else
            {
                GraphicsPath path = this.RoundedRect(rc, 15F);
                Gr.FillPath(br1, path);
                path.Dispose();
            }

            if (this.Button.State == HMIButton.ButtonState.Pressed)
            {
                RectangleF _rc = rc;
                _rc.Inflate(-15F * this.drawRatio, -15F * drawRatio);
                LinearGradientBrush br2 = new LinearGradientBrush(_rc,
                                                                  cDark,
                                                                  bodyColor,
                                                                  45);
                if ((this.Button.Style == HMIButton.ButtonStyle.Circular) ||
                    (this.Button.Style == HMIButton.ButtonStyle.Elliptical))
                {
                    Gr.FillEllipse(br2, _rc);
                }
                else
                {
                    GraphicsPath path = this.RoundedRect(_rc, 10F);
                    Gr.FillPath(br2, path);
                    path.Dispose();
                }

                br2.Dispose();
            }

            br1.Dispose();
            return(true);
        }
        /// <summary>
        /// 画刻度
        /// </summary>
        /// <param name="Gr"></param>
        /// <param name="rc"></param>
        /// <returns></returns>
        public virtual bool DrawScale(Graphics Gr, RectangleF rc)
        {
            if (this.Knob == null)
            {
                return(false);
            }

            Color cKnob     = this.Knob.ScaleColor;
            Color cKnobDark = HMIColorManager.StepColor(cKnob, 60);

            LinearGradientBrush br = new LinearGradientBrush(rc, cKnobDark, cKnob, 45);

            Gr.FillEllipse(br, rc);

            PointF       pf     = new PointF(0.0F, 0.0F);
            Font         ft     = new Font(this.Knob.Font.FontFamily, (float)15F * drawRatio);
            SolidBrush   sb     = new SolidBrush(this.Knob.ScaleValueColor);
            StringFormat format = new StringFormat();

            format.Alignment = StringAlignment.Center;
            if (this.Knob.MaxValue - this.Knob.MinValue != 0)
            {
                for (float i = this.Knob.MinValue; i <= this.Knob.MaxValue; i += this.Knob.StepValue)
                {
                    float degree = 270F * (i - this.Knob.MinValue) / (this.Knob.MaxValue - this.Knob.MinValue);
                    degree = (degree + 135F) * (float)Math.PI / 180F;

                    pf.X = (int)(Math.Cos(degree) * ((rc.Width * 0.5F) - 10F * drawRatio) + rc.X + (rc.Width * 0.5F));
                    pf.Y = (int)(Math.Sin(degree) * ((rc.Width * 0.5F) - 10F * drawRatio) + rc.Y + (rc.Height * 0.5F));

                    string str  = i.ToString();
                    SizeF  size = Gr.MeasureString(str, ft);

                    RectangleF _rc = rc;
                    _rc.X      = pf.X - size.Width / 2F;
                    _rc.Y      = pf.Y - size.Height / 2F;
                    _rc.Width  = size.Width;
                    _rc.Height = size.Height;

                    Gr.DrawString(str, ft, sb, _rc, format);
                }
            }
            ft.Dispose();
            sb.Dispose();
            format.Dispose();
            br.Dispose();

            return(true);
        }
        /// <summary>
        /// 画位置点和当前值
        /// </summary>
        /// <param name="Gr"></param>
        /// <param name="rc"></param>
        /// <param name="pos"></param>
        /// <returns></returns>
        public virtual bool DrawKnobIndicator(Graphics Gr, RectangleF rc, PointF pos)
        {
            if (this.Knob == null)
            {
                return(false);
            }

            RectangleF _rc = rc;

            _rc.X      = pos.X - 4;
            _rc.Y      = pos.Y - 4;
            _rc.Width  = 8;
            _rc.Height = 8;

            Color cKnob     = this.Knob.IndicatorColor;
            Color cKnobDark = HMIColorManager.StepColor(cKnob, 60);

            LinearGradientBrush br = new LinearGradientBrush(_rc, cKnobDark, cKnob, 45);

            Gr.FillEllipse(br, _rc);

            SolidBrush sb  = new SolidBrush(this.Knob.ValueColor);
            Font       f   = new Font(this.Knob.Font.FontFamily, (float)40F * drawRatio);
            string     str = this.Knob.Value.ToString();

            SizeF size = Gr.MeasureString(str, f);

            Gr.DrawString(str,
                          f,
                          sb,
                          this.knobCenter.X - (float)(size.Width * 0.5),
                          this.knobCenter.Y - (float)(size.Height * 0.5));
            sb.Dispose();
            f.Dispose();
            br.Dispose();

            return(true);
        }
Example #6
0
        /// <summary>
        /// 画指针的圆
        /// </summary>
        /// <param name="Gr"></param>
        /// <param name="rc"></param>
        /// <returns></returns>
        public virtual bool DrawNeedleCover(Graphics Gr, RectangleF rc)
        {
            if (this.AnalogMeter == null)
            {
                return(false);
            }

            Color clr = this.AnalogMeter.NeedleColor;

            if (this.AnalogMeter.Value < this.AnalogMeter.MinNValueNor ||
                this.AnalogMeter.Value > this.AnalogMeter.MaxValueNor)
            {
                clr = this.AnalogMeter.UnNormalColor;
            }
            RectangleF _rc = rc;

            Color clr1 = Color.FromArgb(70, clr);

            _rc.Inflate(5 * drawRatio, 5 * drawRatio);

            SolidBrush brTransp = new SolidBrush(clr1);

            Gr.FillEllipse(brTransp, _rc);

            clr1 = clr;
            Color clr2 = HMIColorManager.StepColor(clr, 75);
            LinearGradientBrush br1 = new LinearGradientBrush(rc,
                                                              clr1,
                                                              clr2,
                                                              45);

            Gr.FillEllipse(br1, rc);

            brTransp.Dispose();
            br1.Dispose();
            return(true);
        }
        /// <summary>
        /// 画控件体
        /// </summary>
        /// <param name="Gr"></param>
        /// <param name="rc"></param>
        /// <returns></returns>
        public virtual bool DrawLed(Graphics Gr, RectangleF rc)
        {
            if (this.Led == null)
            {
                return(false);
            }

            Color cDarkOff = HMIColorManager.StepColor(Color.LightGray, 20);
            Color cDarkOn  = HMIColorManager.StepColor(this.Led.LedColor, 60);

            LinearGradientBrush brOff = new LinearGradientBrush(rc,
                                                                Color.Gray,
                                                                cDarkOff,
                                                                45);

            LinearGradientBrush brOn = new LinearGradientBrush(rc,
                                                               this.Led.LedColor,
                                                               cDarkOn,
                                                               45);

            if (this.Led.State == HMILed.LedState.Blink)
            {
                if (this.Led.BlinkIsOn == false)
                {
                    if (this.Led.Style == HMILed.LedStyle.Circular)
                    {
                        Gr.FillEllipse(brOff, rc);
                    }
                    else if (this.Led.Style == HMILed.LedStyle.Rectangular)
                    {
                        Gr.FillRectangle(brOff, rc);
                    }
                }
                else
                {
                    if (this.Led.Style == HMILed.LedStyle.Circular)
                    {
                        Gr.FillEllipse(brOn, rc);
                    }
                    else if (this.Led.Style == HMILed.LedStyle.Rectangular)
                    {
                        Gr.FillRectangle(brOn, rc);
                    }
                }
            }
            else
            {
                if (this.Led.State == HMILed.LedState.Off)
                {
                    if (this.Led.Style == HMILed.LedStyle.Circular)
                    {
                        Gr.FillEllipse(brOff, rc);
                    }
                    else if (this.Led.Style == HMILed.LedStyle.Rectangular)
                    {
                        Gr.FillRectangle(brOff, rc);
                    }
                }
                else
                {
                    if (this.Led.Style == HMILed.LedStyle.Circular)
                    {
                        Gr.FillEllipse(brOn, rc);
                    }
                    else if (this.Led.Style == HMILed.LedStyle.Rectangular)
                    {
                        Gr.FillRectangle(brOn, rc);
                    }
                }
            }

            brOff.Dispose();
            brOn.Dispose();

            return(true);
        }
        /// <summary>
        /// 画文本
        /// </summary>
        /// <param name="Gr"></param>
        /// <param name="rc"></param>
        /// <returns></returns>
        public virtual bool DrawText(Graphics Gr, RectangleF rc)
        {
            if (this.Button == null)
            {
                return(false);
            }
            switch (this.Button.LableStyl)
            {
            case HMIButton.ButtonLabelSylt.Text:
                //画字符串
                Font font = new Font(this.Button.Font.FontFamily,
                                     this.Button.Font.Size * this.drawRatio,
                                     this.Button.Font.Style);

                String str = this.Button.Label;

                Color bodyColor = this.Button.ForeColor;
                Color cDark     = HMIColorManager.StepColor(bodyColor, 20);

                SizeF size = Gr.MeasureString(str, font);

                SolidBrush br1 = new SolidBrush(bodyColor);
                SolidBrush br2 = new SolidBrush(cDark);

                Gr.DrawString(str,
                              font,
                              br1,
                              rc.Left + ((rc.Width * 0.5F) - (float)(size.Width * 0.5F)) + (float)(1 * this.drawRatio),
                              rc.Top + ((rc.Height * 0.5F) - (float)(size.Height * 0.5)) + (float)(1 * this.drawRatio));

                Gr.DrawString(str,
                              font,
                              br2,
                              rc.Left + ((rc.Width * 0.5F) - (float)(size.Width * 0.5F)),
                              rc.Top + ((rc.Height * 0.5F) - (float)(size.Height * 0.5)));

                br1.Dispose();
                br2.Dispose();
                font.Dispose();
                break;

            case HMIButton.ButtonLabelSylt.Image:
                if (this.Button.LableImage != null)
                {
                    RectangleF temp = rc;
                    temp.Inflate(-25F * this.drawRatio, -25F * drawRatio);
                    Rectangle temprc = new Rectangle();
                    temprc.X      = (int)temp.X;
                    temprc.Y      = (int)temp.Y;
                    temprc.Height = (int)temp.Height;
                    temprc.Width  = (int)temp.Width;

                    Rectangle src = new Rectangle();
                    src.X                = 0;
                    src.Y                = 0;
                    src.Width            = this.Button.LableImage.Width;
                    src.Height           = this.Button.LableImage.Height;
                    Gr.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    Gr.DrawImage(this.Button.LableImage, temprc, src, GraphicsUnit.Pixel);
                }
                break;

            default:
                break;
            }


            return(false);
        }
        /// <summary>
        /// 画环形刻度指示
        /// </summary>
        /// <param name="Gr"></param>
        /// <param name="rc"></param>
        /// <returns></returns>
        public virtual bool DrawCircularScale(Graphics Gr, RectangleF rc)
        {
            if (this.Knob == null)
            {
                return(false);
            }

            Color cKnob     = this.Knob.ScaleColor;
            Color cKnobDark = HMIColorManager.StepColor(cKnob, 60);

            LinearGradientBrush br1 = new LinearGradientBrush(rc, cKnobDark, cKnob, 45);

            Gr.FillEllipse(br1, rc);

            Color cKnob1     = this.Knob.ScaleColor;
            Color cKnob2     = this.Knob.ScaleOtherColor;
            Color cKnobDark1 = HMIColorManager.StepColor(cKnob1, this.Knob.ScaleColorStep);
            Color cKnobDark2 = HMIColorManager.StepColor(cKnob2, this.Knob.ScaleColorStep);
            Color tempColor  = cKnobDark2;

            GraphicsPath pth = new GraphicsPath();
            SolidBrush   br  = new SolidBrush(tempColor);
            Pen          pen = new Pen(tempColor);

            if (this.Knob.MaxValue - this.Knob.MinValue != 0)
            {
                float startDegree = 90F;
                if (this.Knob.ScaleInterverlFlag)
                {
                    startDegree = 89F;
                }
                PointF[] points = new PointF[(int)(this.Knob.MaxValue - this.Knob.MinValue + this.Knob.StepValue)];
                points[0] = new PointF();
                float degree      = 360F * (0 - this.Knob.MinValue) / (this.Knob.MaxValue - this.Knob.MinValue + this.Knob.StepValue);
                float begindegree = (degree + startDegree) * (float)Math.PI / 180F;
                degree      = (degree + 90F) * (float)Math.PI / 180F;
                points[0].X = (float)(Math.Cos(degree) * (this.derectionRect.Width * 0.5F - this.drawRatio * this.Knob.Knob8DerectionWight) + this.derectionRect.Width * 0.5F);
                points[0].Y = (float)(Math.Sin(degree) * (this.derectionRect.Width * 0.5F - this.drawRatio * this.Knob.Knob8DerectionWight) + this.derectionRect.Height * 0.5F);
                PointF realBeginPoint = new PointF();
                realBeginPoint.X = (float)(Math.Cos(begindegree) * (this.derectionRect.Width * 0.5F - this.drawRatio * this.Knob.Knob8DerectionWight) + this.derectionRect.Width * 0.5F);
                realBeginPoint.Y = (float)(Math.Sin(begindegree) * (this.derectionRect.Width * 0.5F - this.drawRatio * this.Knob.Knob8DerectionWight) + this.derectionRect.Height * 0.5F);
                for (float i = this.Knob.MinValue; i <= this.Knob.MaxValue; i += this.Knob.StepValue)
                {
                    PointF realEndPoint = new PointF();
                    if (i < this.Knob.MaxValue)
                    {
                        points[(int)(i + this.Knob.StepValue)] = new PointF();

                        degree = 360F * (i + this.Knob.StepValue - this.Knob.MinValue) / (this.Knob.MaxValue - this.Knob.MinValue + this.Knob.StepValue);
                        float degree2 = (degree + startDegree) * (float)Math.PI / 180F;
                        degree = (degree + 90F) * (float)Math.PI / 180F;
                        points[(int)(i + this.Knob.StepValue)].X = (float)(Math.Cos(degree) * (this.derectionRect.Width * 0.5F - this.drawRatio * this.Knob.Knob8DerectionWight) + this.derectionRect.Width * 0.5F);
                        points[(int)(i + this.Knob.StepValue)].Y = (float)(Math.Sin(degree) * (this.derectionRect.Width * 0.5F - this.drawRatio * this.Knob.Knob8DerectionWight) + this.derectionRect.Height * 0.5F);
                        realEndPoint.X = (float)(Math.Cos(degree2) * (this.derectionRect.Width * 0.5F - this.drawRatio * this.Knob.Knob8DerectionWight) + this.derectionRect.Width * 0.5F);
                        realEndPoint.Y = (float)(Math.Sin(degree2) * (this.derectionRect.Width * 0.5F - this.drawRatio * this.Knob.Knob8DerectionWight) + this.derectionRect.Height * 0.5F);
                        //points[(int)(i + this.Knob.StepValue)].X = (float)(Math.Cos(degree) * ((this.drawRect.Width * 0.5F)) + (this.drawRect.Width * 0.5F));
                        //points[(int)(i + this.Knob.StepValue)].Y = (float)(Math.Sin(degree) * ((this.drawRect.Height * 0.5F)) + (this.drawRect.Height * 0.5F));
                    }
                    //if (i % 2 == 0)
                    //{
                    if (Knob.Value >= i)
                    {
                        tempColor = cKnob2;
                    }
                    else
                    {
                        tempColor = cKnobDark1;
                    }
                    //}
                    //else
                    //{
                    //    if (Knob.Value >= i) tempColor = cKnob1;
                    //    else tempColor = cKnobDark1;
                    //}

                    float degreeBegin = 360F * (i - this.Knob.MinValue) / (this.Knob.MaxValue - this.Knob.MinValue + this.Knob.StepValue) + 90;
                    float degreeEnd   = 360F * (i + 1 - this.Knob.MinValue) / (this.Knob.MaxValue - this.Knob.MinValue + this.Knob.StepValue) + 90;
                    pth = new GraphicsPath();
                    pth.AddLine(this.knobCenter, points[(int)i]);
                    pth.AddArc(rc.X, rc.Y, rc.Width, rc.Height, degreeBegin, degreeEnd - degreeBegin);
                    if (i == this.Knob.MaxValue)
                    {
                        pth.AddLine(realBeginPoint, this.knobCenter);
                    }
                    else
                    {
                        pth.AddLine(realEndPoint, this.knobCenter);
                    }
                    //pth.AddArc(rectKnob.X, rectKnob.Y, rectKnob.Width, rectKnob.Height, degreeEnd, degreeBegin - degreeEnd);
                    br  = new SolidBrush(tempColor);
                    pen = new Pen(tempColor);
                    Gr.DrawPath(pen, pth);
                    Gr.FillPath(br, pth);
                    //br.Dispose();
                    //pen.Dispose();
                    //pth.Dispose();
                }
            }


            return(true);
        }
        /// <summary>
        /// 画外圈8向指示
        /// </summary>
        /// <param name="Gr"></param>
        /// <param name="rc"></param>
        /// <returns></returns>
        public virtual bool DrawDerection(Graphics Gr, RectangleF rc)
        {
            if (this.Knob == null)
            {
                return(false);
            }
            if (!this.Knob.Display8DerectionFlag)
            {
                return(true);
            }

            PointF[] points = this.Knob.GetDerectionPoints();

            //上方
            Color tempColor = this.Knob.TopColor;

            if (this.Knob.KnobDerectionType != HMIKnob.Knob8DerectionType.Top)
            {
                tempColor = HMIColorManager.StepColor(tempColor, this.Knob.DerectionColorStep);
            }
            GraphicsPath pth = new GraphicsPath();

            pth.AddLine(points[0], points[1]);
            pth.AddArc(this.derectionRect.X, this.derectionRect.Y, this.derectionRect.Width, this.derectionRect.Height, 247.5F, 45F);
            pth.AddLine(points[2], points[3]);
            pth.AddArc(this.derectionRect.X + this.Knob.Knob8DerectionWight * drawRatio, this.derectionRect.Y + this.Knob.Knob8DerectionWight * drawRatio,
                       this.derectionRect.Width - 2.0F * this.Knob.Knob8DerectionWight * drawRatio, this.derectionRect.Height - 2.0F * this.Knob.Knob8DerectionWight * drawRatio, 292.5F, -45F);
            SolidBrush br  = new SolidBrush(tempColor);
            Pen        pen = new Pen(tempColor);

            Gr.DrawPath(pen, pth);
            Gr.FillPath(br, pth);
            br.Dispose();
            pen.Dispose();
            pth.Dispose();

            //右上
            tempColor = this.Knob.Top_Right_Color;
            if (this.Knob.KnobDerectionType != HMIKnob.Knob8DerectionType.Top_Right)
            {
                tempColor = HMIColorManager.StepColor(tempColor, this.Knob.DerectionColorStep);
            }
            pth = new GraphicsPath();
            pth.AddLine(points[3], points[2]);
            pth.AddArc(this.derectionRect.X, this.derectionRect.Y, this.derectionRect.Width, this.derectionRect.Height, 292.5F, 45F);
            pth.AddLine(points[5], points[4]);
            pth.AddArc(this.derectionRect.X + this.Knob.Knob8DerectionWight * drawRatio, this.derectionRect.Y + this.Knob.Knob8DerectionWight * drawRatio,
                       this.derectionRect.Width - 2.0F * this.Knob.Knob8DerectionWight * drawRatio, this.derectionRect.Height - 2.0F * this.Knob.Knob8DerectionWight * drawRatio, 337.5F, -45F);
            br  = new SolidBrush(tempColor);
            pen = new Pen(tempColor);
            Gr.DrawPath(pen, pth);
            Gr.FillPath(br, pth);
            br.Dispose();
            pen.Dispose();
            pth.Dispose();

            //右
            tempColor = this.Knob.RightColor;
            if (this.Knob.KnobDerectionType != HMIKnob.Knob8DerectionType.Right)
            {
                tempColor = HMIColorManager.StepColor(tempColor, this.Knob.DerectionColorStep);
            }
            pth = new GraphicsPath();
            pth.AddLine(points[4], points[5]);
            pth.AddArc(this.derectionRect.X, this.derectionRect.Y, this.derectionRect.Width, this.derectionRect.Height, 337.5F, 45F);
            pth.AddLine(points[6], points[7]);
            pth.AddArc(this.derectionRect.X + this.Knob.Knob8DerectionWight * drawRatio, this.derectionRect.Y + this.Knob.Knob8DerectionWight * drawRatio,
                       this.derectionRect.Width - 2.0F * this.Knob.Knob8DerectionWight * drawRatio, this.derectionRect.Height - 2.0F * this.Knob.Knob8DerectionWight * drawRatio, 22.5F, -45F);
            br  = new SolidBrush(tempColor);
            pen = new Pen(tempColor);
            Gr.DrawPath(pen, pth);
            Gr.FillPath(br, pth);
            br.Dispose();
            pen.Dispose();
            pth.Dispose();

            //右下
            tempColor = this.Knob.Buttom_Right_Color;
            if (this.Knob.KnobDerectionType != HMIKnob.Knob8DerectionType.Buttom_Right)
            {
                tempColor = HMIColorManager.StepColor(tempColor, this.Knob.DerectionColorStep);
            }
            pth = new GraphicsPath();
            pth.AddLine(points[7], points[6]);
            pth.AddArc(this.derectionRect.X, this.derectionRect.Y, this.derectionRect.Width, this.derectionRect.Height, 22.5F, 45F);
            pth.AddLine(points[9], points[8]);
            pth.AddArc(this.derectionRect.X + this.Knob.Knob8DerectionWight * drawRatio, this.derectionRect.Y + this.Knob.Knob8DerectionWight * drawRatio,
                       this.derectionRect.Width - 2.0F * this.Knob.Knob8DerectionWight * drawRatio, this.derectionRect.Height - 2.0F * this.Knob.Knob8DerectionWight * drawRatio, 67.5F, -45F);
            br  = new SolidBrush(tempColor);
            pen = new Pen(tempColor);
            Gr.DrawPath(pen, pth);
            Gr.FillPath(br, pth);
            br.Dispose();
            pen.Dispose();
            pth.Dispose();

            //下
            tempColor = this.Knob.ButtomColor;
            if (this.Knob.KnobDerectionType != HMIKnob.Knob8DerectionType.Buttom)
            {
                tempColor = HMIColorManager.StepColor(tempColor, this.Knob.DerectionColorStep);
            }
            pth = new GraphicsPath();
            pth.AddLine(points[8], points[9]);
            pth.AddArc(this.derectionRect.X, this.derectionRect.Y, this.derectionRect.Width, this.derectionRect.Height, 67.5F, 45F);
            pth.AddLine(points[10], points[11]);
            pth.AddArc(this.derectionRect.X + this.Knob.Knob8DerectionWight * drawRatio, this.derectionRect.Y + this.Knob.Knob8DerectionWight * drawRatio,
                       this.derectionRect.Width - 2.0F * this.Knob.Knob8DerectionWight * drawRatio, this.derectionRect.Height - 2.0F * this.Knob.Knob8DerectionWight * drawRatio, 112.5F, -45F);
            br  = new SolidBrush(tempColor);
            pen = new Pen(tempColor);
            Gr.DrawPath(pen, pth);
            Gr.FillPath(br, pth);
            br.Dispose();
            pen.Dispose();
            pth.Dispose();

            //左下
            tempColor = this.Knob.Buttom_Left_Color;
            if (this.Knob.KnobDerectionType != HMIKnob.Knob8DerectionType.Buttom_Left)
            {
                tempColor = HMIColorManager.StepColor(tempColor, this.Knob.DerectionColorStep);
            }
            pth = new GraphicsPath();
            pth.AddLine(points[11], points[10]);
            pth.AddArc(this.derectionRect.X, this.derectionRect.Y, this.derectionRect.Width, this.derectionRect.Height, 112.5F, 45F);
            pth.AddLine(points[13], points[12]);
            pth.AddArc(this.derectionRect.X + this.Knob.Knob8DerectionWight * drawRatio, this.derectionRect.Y + this.Knob.Knob8DerectionWight * drawRatio,
                       this.derectionRect.Width - 2.0F * this.Knob.Knob8DerectionWight * drawRatio, this.derectionRect.Height - 2.0F * this.Knob.Knob8DerectionWight * drawRatio, 157.5F, -45F);
            br  = new SolidBrush(tempColor);
            pen = new Pen(tempColor);
            Gr.DrawPath(pen, pth);
            Gr.FillPath(br, pth);
            br.Dispose();
            pen.Dispose();
            pth.Dispose();

            //左
            tempColor = this.Knob.LeftColor;
            if (this.Knob.KnobDerectionType != HMIKnob.Knob8DerectionType.Left)
            {
                tempColor = HMIColorManager.StepColor(tempColor, this.Knob.DerectionColorStep);
            }
            pth = new GraphicsPath();
            pth.AddLine(points[12], points[13]);
            pth.AddArc(this.derectionRect.X, this.derectionRect.Y, this.derectionRect.Width, this.derectionRect.Height, 157.5F, 45F);
            pth.AddLine(points[14], points[15]);
            pth.AddArc(this.derectionRect.X + this.Knob.Knob8DerectionWight * drawRatio, this.derectionRect.Y + this.Knob.Knob8DerectionWight * drawRatio,
                       this.derectionRect.Width - 2.0F * this.Knob.Knob8DerectionWight * drawRatio, this.derectionRect.Height - 2.0F * this.Knob.Knob8DerectionWight * drawRatio, 202.5F, -45F);
            br  = new SolidBrush(tempColor);
            pen = new Pen(tempColor);
            Gr.DrawPath(pen, pth);
            Gr.FillPath(br, pth);
            br.Dispose();
            pen.Dispose();
            pth.Dispose();

            //左上
            tempColor = this.Knob.Top_Left_Color;
            if (this.Knob.KnobDerectionType != HMIKnob.Knob8DerectionType.Top_Left)
            {
                tempColor = HMIColorManager.StepColor(tempColor, this.Knob.DerectionColorStep);
            }
            pth = new GraphicsPath();
            pth.AddLine(points[15], points[14]);
            pth.AddArc(this.derectionRect.X, this.derectionRect.Y, this.derectionRect.Width, this.derectionRect.Height, 202.5F, 45F);
            pth.AddLine(points[1], points[0]);
            pth.AddArc(this.derectionRect.X + this.Knob.Knob8DerectionWight * drawRatio, this.derectionRect.Y + this.Knob.Knob8DerectionWight * drawRatio,
                       this.derectionRect.Width - 2.0F * this.Knob.Knob8DerectionWight * drawRatio, this.derectionRect.Height - 2.0F * this.Knob.Knob8DerectionWight * drawRatio, 247.5F, -45F);
            br  = new SolidBrush(tempColor);
            pen = new Pen(tempColor);
            Gr.DrawPath(pen, pth);
            Gr.FillPath(br, pth);
            br.Dispose();
            pen.Dispose();
            pth.Dispose();

            return(true);
        }