public MarkerStyleAttrib GetMarkerStyleAttrib(GaugeGraphics g)
        {
            MarkerStyleAttrib markerStyleAttrib  = new MarkerStyleAttrib();
            float             absoluteDimension  = g.GetAbsoluteDimension(this.MarkerLength);
            float             absoluteDimension2 = g.GetAbsoluteDimension(this.Width);

            markerStyleAttrib.path = g.CreateMarker(new PointF(0f, 0f), absoluteDimension2, absoluteDimension, this.MarkerStyle);
            float num = 0f;

            if (this.Placement == Placement.Cross || this.Placement == Placement.Inside)
            {
                num = (float)(num + 180.0);
            }
            if (this.GetGauge().GetOrientation() == GaugeOrientation.Vertical)
            {
                num = (float)(num + 270.0);
            }
            if (num > 0.0)
            {
                using (Matrix matrix = new Matrix())
                {
                    matrix.Rotate(num);
                    markerStyleAttrib.path.Transform(matrix);
                }
            }
            float     num2              = this.CalculateMarkerDistance();
            ScaleBase scale             = this.GetScale();
            float     positionFromValue = scale.GetPositionFromValue(scale.GetValueLimit(base.Position));
            PointF    pointOrigin       = Point.Empty;

            pointOrigin             = ((this.GetGauge().GetOrientation() != 0) ? g.GetAbsolutePoint(new PointF(num2, positionFromValue)) : g.GetAbsolutePoint(new PointF(positionFromValue, num2)));
            markerStyleAttrib.brush = g.GetMarkerBrush(markerStyleAttrib.path, this.MarkerStyle, pointOrigin, 0f, this.FillColor, this.FillGradientType, this.FillGradientEndColor, this.FillHatchStyle);
            using (Matrix matrix2 = new Matrix())
            {
                matrix2.Translate(pointOrigin.X, pointOrigin.Y, MatrixOrder.Append);
                markerStyleAttrib.path.Transform(matrix2);
                return(markerStyleAttrib);
            }
        }
        internal MarkerStyleAttrib GetMarkerStyleAttrib(GaugeGraphics g)
        {
            MarkerStyleAttrib markerStyleAttrib  = new MarkerStyleAttrib();
            float             absoluteDimension  = g.GetAbsoluteDimension(MarkerLength);
            float             absoluteDimension2 = g.GetAbsoluteDimension(Width);

            markerStyleAttrib.path = g.CreateMarker(new PointF(0f, 0f), absoluteDimension2, absoluteDimension, MarkerStyle);
            float num = 0f;

            if (Placement == Placement.Cross || Placement == Placement.Inside)
            {
                num += 180f;
            }
            if (GetGauge().GetOrientation() == GaugeOrientation.Vertical)
            {
                num += 270f;
            }
            if (num > 0f)
            {
                using (Matrix matrix = new Matrix())
                {
                    matrix.Rotate(num);
                    markerStyleAttrib.path.Transform(matrix);
                }
            }
            float       num2              = CalculateMarkerDistance();
            LinearScale scale             = GetScale();
            float       positionFromValue = scale.GetPositionFromValue(scale.GetValueLimit(base.Position));
            PointF      pointF            = Point.Empty;

            pointF = ((GetGauge().GetOrientation() != 0) ? g.GetAbsolutePoint(new PointF(num2, positionFromValue)) : g.GetAbsolutePoint(new PointF(positionFromValue, num2)));
            markerStyleAttrib.brush = g.GetMarkerBrush(markerStyleAttrib.path, MarkerStyle, pointF, 0f, FillColor, FillGradientType, FillGradientEndColor, FillHatchStyle);
            using (Matrix matrix2 = new Matrix())
            {
                matrix2.Translate(pointF.X, pointF.Y, MatrixOrder.Append);
                markerStyleAttrib.path.Transform(matrix2);
                return(markerStyleAttrib);
            }
        }
Example #3
0
        public KnobStyleAttrib GetKnobStyleAttrib(GaugeGraphics g, PointF pointOrigin, float angle)
        {
            KnobStyleAttrib knobStyleAttrib = new KnobStyleAttrib();

            if (this.Image != "" && this.CapImage != "")
            {
                return(knobStyleAttrib);
            }
            float absoluteDimension = g.GetAbsoluteDimension(this.Width);
            float num = (float)(this.CapWidth / 100.0 * absoluteDimension);

            knobStyleAttrib.paths   = new GraphicsPath[6];
            knobStyleAttrib.brushes = new Brush[6];
            if (this.Image == "")
            {
                knobStyleAttrib.paths[0] = this.GetKnobPath(g, absoluteDimension, (float)(absoluteDimension * 0.5));
            }
            else
            {
                knobStyleAttrib.paths[0] = null;
            }
            if (this.CapVisible && this.CapImage == "")
            {
                if (this.CapShadowOffset != 0.0)
                {
                    knobStyleAttrib.paths[1] = new GraphicsPath();
                    knobStyleAttrib.paths[1].AddEllipse((float)(0.0 - num + this.CapShadowOffset), (float)(0.0 - num + this.CapShadowOffset), (float)(num * 2.0), (float)(num * 2.0));
                    using (Matrix matrix = new Matrix())
                    {
                        matrix.Translate(pointOrigin.X, pointOrigin.Y, MatrixOrder.Append);
                        knobStyleAttrib.paths[1].Transform(matrix);
                    }
                }
                knobStyleAttrib.paths[2] = new GraphicsPath();
                knobStyleAttrib.paths[2].AddEllipse((float)(0.0 - num), (float)(0.0 - num), (float)(num * 2.0), (float)(num * 2.0));
            }
            else
            {
                if (this.CapShadowOffset == 0.0)
                {
                    knobStyleAttrib.paths[1] = null;
                }
                knobStyleAttrib.paths[2] = null;
            }
            float  y            = (float)(this.MarkerPosition / 100.0 * absoluteDimension * 2.0);
            float  num2         = (float)(this.MarkerWidth / 100.0 * absoluteDimension * 2.0);
            float  markerHeight = (float)(this.MarkerLength / 100.0 * absoluteDimension * 2.0);
            PointF point        = new PointF(0f, y);

            knobStyleAttrib.paths[3] = g.CreateMarker(point, num2, markerHeight, this.MarkerStyle);
            using (Matrix matrix2 = new Matrix())
            {
                matrix2.RotateAt(180f, point, MatrixOrder.Append);
                if (!this.MarkerRotateGradient)
                {
                    matrix2.Rotate(angle, MatrixOrder.Append);
                    matrix2.Translate(pointOrigin.X, pointOrigin.Y, MatrixOrder.Append);
                }
                knobStyleAttrib.paths[3].Transform(matrix2);
            }
            if (this.Image == "" && knobStyleAttrib.paths[0] != null)
            {
                float angle2 = (float)(this.RotateGradient ? angle : 0.0);
                knobStyleAttrib.brushes[0] = this.GetFillBrush(g, knobStyleAttrib.paths[0], pointOrigin, angle2, this.FillColor, this.FillGradientType, this.FillGradientEndColor, this.FillHatchStyle);
            }
            else
            {
                knobStyleAttrib.brushes[0] = null;
            }
            if (this.CapVisible && this.CapImage == "")
            {
                if (this.CapShadowOffset != 0.0)
                {
                    knobStyleAttrib.brushes[1] = g.GetShadowBrush();
                }
                float angle3 = (float)(this.CapRotateGradient ? angle : 0.0);
                knobStyleAttrib.brushes[2] = this.GetFillBrush(g, knobStyleAttrib.paths[2], pointOrigin, angle3, this.CapFillColor, this.CapFillGradientType, this.CapFillGradientEndColor, this.CapFillHatchStyle);
            }
            else
            {
                if (this.CapShadowOffset == 0.0)
                {
                    knobStyleAttrib.brushes[1] = null;
                }
                knobStyleAttrib.brushes[2] = null;
            }
            float  angle4       = (float)(this.MarkerRotateGradient ? angle : 0.0);
            PointF pointOrigin2 = pointOrigin;

            if (!this.MarkerRotateGradient)
            {
                pointOrigin2 = new PointF(0f, 0f);
            }
            knobStyleAttrib.brushes[3] = g.GetMarkerBrush(knobStyleAttrib.paths[3], this.MarkerStyle, pointOrigin2, angle4, this.MarkerFillColor, this.MarkerFillGradientType, this.MarkerFillGradientEndColor, this.MarkerFillHatchStyle);
            if (this.CapVisible && this.CapReflection && this.CapImage == "")
            {
                g.GetCircularEdgeReflection(knobStyleAttrib.paths[2].GetBounds(), 135f, 200, pointOrigin, out knobStyleAttrib.paths[4], out knobStyleAttrib.brushes[4]);
                g.GetCircularEdgeReflection(knobStyleAttrib.paths[2].GetBounds(), 315f, 128, pointOrigin, out knobStyleAttrib.paths[5], out knobStyleAttrib.brushes[5]);
            }
            else
            {
                knobStyleAttrib.paths[4]   = null;
                knobStyleAttrib.paths[5]   = null;
                knobStyleAttrib.brushes[4] = null;
                knobStyleAttrib.brushes[5] = null;
            }
            using (Matrix matrix3 = new Matrix())
            {
                matrix3.Rotate(angle, MatrixOrder.Append);
                matrix3.Translate(pointOrigin.X, pointOrigin.Y, MatrixOrder.Append);
                if (knobStyleAttrib.paths[0] != null)
                {
                    knobStyleAttrib.paths[0].Transform(matrix3);
                }
                if (knobStyleAttrib.paths[2] != null)
                {
                    knobStyleAttrib.paths[2].Transform(matrix3);
                }
                if (knobStyleAttrib.paths[3] != null)
                {
                    if (this.MarkerRotateGradient)
                    {
                        knobStyleAttrib.paths[3].Transform(matrix3);
                        return(knobStyleAttrib);
                    }
                    return(knobStyleAttrib);
                }
                return(knobStyleAttrib);
            }
        }