public virtual void DrawBorder(MapGraphics graph, Frame borderSkin, RectangleF rect, Color backColor, MapHatchStyle backHatchStyle, string backImage, MapImageWrapMode backImageMode, Color backImageTranspColor, MapImageAlign backImageAlign, GradientType backGradientType, Color backSecondaryColor, Color borderColor, int borderWidth, MapDashStyle borderStyle)
        {
            RectangleF rectangleF  = MapGraphics.Round(rect);
            RectangleF rect2       = rectangleF;
            float      num         = (float)(0.20000000298023224 + 0.40000000596046448 * (float)(borderSkin.PageColor.R + borderSkin.PageColor.G + borderSkin.PageColor.B) / 765.0);
            Color      centerColor = Color.FromArgb((int)((float)(int)borderSkin.PageColor.R * num), (int)((float)(int)borderSkin.PageColor.G * num), (int)((float)(int)borderSkin.PageColor.B * num));

            if (borderSkin.PageColor == Color.Transparent)
            {
                centerColor = Color.FromArgb(60, 0, 0, 0);
            }
            num = (float)(num + 0.20000000298023224);
            Color centerColor2 = Color.FromArgb((int)((float)(int)borderSkin.PageColor.R * num), (int)((float)(int)borderSkin.PageColor.G * num), (int)((float)(int)borderSkin.PageColor.B * num));
            float val          = 15f;

            val = Math.Max(val, 2f);
            val = Math.Min(val, (float)(rect.Width / 2.0));
            val = Math.Min(val, (float)(rect.Height / 2.0));
            val = (float)Math.Ceiling((double)val);
            graph.FillRectangle(new SolidBrush(borderSkin.PageColor), rect);
            rect2         = rectangleF;
            rect2.Width  -= (float)(val * 0.30000001192092896);
            rect2.Height -= (float)(val * 0.30000001192092896);
            graph.DrawRoundedRectShadowAbs(rect2, this.cornerRadius, (float)(val + 1.0), centerColor2, borderSkin.PageColor, 1.4f);
            rect2         = rectangleF;
            rect2.X       = (float)(rectangleF.X + val / 3.0);
            rect2.Y       = (float)(rectangleF.Y + val / 3.0);
            rect2.Width  -= (float)(val / 3.5);
            rect2.Height -= (float)(val / 3.5);
            graph.DrawRoundedRectShadowAbs(rect2, this.cornerRadius, val, centerColor, borderSkin.PageColor, 1.3f);
            rect2         = rectangleF;
            rect2.X       = (float)(rectangleF.X + 3.0);
            rect2.Y       = (float)(rectangleF.Y + 3.0);
            rect2.Width  -= (float)(val * 0.75);
            rect2.Height -= (float)(val * 0.75);
            GraphicsPath graphicsPath = graph.CreateRoundedRectPath(rect2, this.cornerRadius);

            graph.DrawPathAbs(graphicsPath, backColor, backHatchStyle, backImage, backImageMode, backImageTranspColor, backImageAlign, backGradientType, backSecondaryColor, borderColor, borderWidth, borderStyle, PenAlignment.Inset);
            if (graphicsPath != null)
            {
                graphicsPath.Dispose();
            }
            using (Region region = new Region(graph.CreateRoundedRectPath(new RectangleF(rect2.X - val, rect2.Y - val, (float)(rect2.Width + val - val * 0.25), (float)(rect2.Height + val - val * 0.25)), this.cornerRadius)))
            {
                region.Complement(graph.CreateRoundedRectPath(rect2, this.cornerRadius));
                Region clip = graph.Clip;
                graph.Clip = region;
                graph.DrawRoundedRectShadowAbs(rect2, this.cornerRadius, val, Color.Transparent, Color.FromArgb(128, Color.Gray), 0.5f);
                graph.Clip = clip;
            }
        }
Exemplo n.º 2
0
        public virtual void DrawBorder(MapGraphics graph, Frame borderSkin, RectangleF rect, Color backColor, MapHatchStyle backHatchStyle, string backImage, MapImageWrapMode backImageMode, Color backImageTranspColor, MapImageAlign backImageAlign, GradientType backGradientType, Color backSecondaryColor, Color borderColor, int borderWidth, MapDashStyle borderStyle)
        {
            RectangleF rectangleF  = MapGraphics.Round(rect);
            RectangleF rectangleF2 = rectangleF;
            float      num         = (float)(0.30000001192092896 + 0.40000000596046448 * (float)(borderSkin.PageColor.R + borderSkin.PageColor.G + borderSkin.PageColor.B) / 765.0);
            Color      color       = Color.FromArgb((int)((float)(int)backColor.R * num), (int)((float)(int)backColor.G * num), (int)((float)(int)backColor.B * num));

            num = (float)(num + 0.20000000298023224);
            Color centerColor = Color.FromArgb((int)((float)(int)borderSkin.PageColor.R * num), (int)((float)(int)borderSkin.PageColor.G * num), (int)((float)(int)borderSkin.PageColor.B * num));

            if (borderSkin.PageColor == Color.Transparent)
            {
                centerColor = Color.FromArgb(60, 0, 0, 0);
            }
            Color.FromArgb((int)((float)(int)backColor.R * num), (int)((float)(int)backColor.G * num), (int)((float)(int)backColor.B * num));
            float val = this.defaultRadiusSize;

            val = Math.Max(val, 2f);
            val = Math.Min(val, (float)(rect.Width / 2.0));
            val = Math.Min(val, (float)(rect.Height / 2.0));
            val = (float)Math.Ceiling((double)val);
            graph.FillRectangle(new SolidBrush(borderSkin.PageColor), rect);
            if (this.drawOutsideTopLeftShadow)
            {
                rectangleF2         = rectangleF;
                rectangleF2.X      -= (float)(val * 0.30000001192092896);
                rectangleF2.Y      -= (float)(val * 0.30000001192092896);
                rectangleF2.Width  -= (float)(val * 0.30000001192092896);
                rectangleF2.Height -= (float)(val * 0.30000001192092896);
                graph.DrawRoundedRectShadowAbs(rectangleF2, this.cornerRadius, val, Color.FromArgb(128, Color.Black), borderSkin.PageColor, this.outsideShadowRate);
            }
            rectangleF2         = rectangleF;
            rectangleF2.X      += (float)(val * 0.30000001192092896);
            rectangleF2.Y      += (float)(val * 0.30000001192092896);
            rectangleF2.Width  -= (float)(val * 0.30000001192092896);
            rectangleF2.Height -= (float)(val * 0.30000001192092896);
            graph.DrawRoundedRectShadowAbs(rectangleF2, this.cornerRadius, val, centerColor, borderSkin.PageColor, this.outsideShadowRate);
            rectangleF2         = rectangleF;
            rectangleF2.Width  -= (float)(val * 0.30000001192092896);
            rectangleF2.Height -= (float)(val * 0.30000001192092896);
            GraphicsPath graphicsPath = graph.CreateRoundedRectPath(rectangleF2, this.cornerRadius);

            graph.DrawPathAbs(graphicsPath, backColor, backHatchStyle, backImage, backImageMode, backImageTranspColor, backImageAlign, backGradientType, backSecondaryColor, borderColor, borderWidth, borderStyle, PenAlignment.Inset);
            if (graphicsPath != null)
            {
                graphicsPath.Dispose();
            }
            if (this.drawScrews)
            {
                RectangleF empty = RectangleF.Empty;
                float      num2  = (float)(val * 0.40000000596046448);
                empty.X      = rectangleF2.X + num2;
                empty.Y      = rectangleF2.Y + num2;
                empty.Width  = (float)(val * 0.550000011920929);
                empty.Height = empty.Width;
                this.DrawScrew(graph, empty);
                empty.X = rectangleF2.Right - num2 - empty.Width;
                this.DrawScrew(graph, empty);
                empty.X = rectangleF2.Right - num2 - empty.Width;
                empty.Y = rectangleF2.Bottom - num2 - empty.Height;
                this.DrawScrew(graph, empty);
                empty.X = rectangleF2.X + num2;
                empty.Y = rectangleF2.Bottom - num2 - empty.Height;
                this.DrawScrew(graph, empty);
            }
            if (this.drawBottomShadow)
            {
                rectangleF2         = rectangleF;
                rectangleF2.Width  -= (float)(val * 0.30000001192092896);
                rectangleF2.Height -= (float)(val * 0.30000001192092896);
                using (Region region = new Region(graph.CreateRoundedRectPath(new RectangleF(rectangleF2.X - val, rectangleF2.Y - val, (float)(rectangleF2.Width + 0.5 * val), (float)(rectangleF2.Height + 0.5 * val)), this.cornerRadius)))
                {
                    region.Complement(graph.CreateRoundedRectPath(rectangleF2, this.cornerRadius));
                    Region clip = graph.Clip;
                    graph.Clip          = region;
                    rectangleF2.X      -= (float)(0.5 * val);
                    rectangleF2.Width  += (float)(0.5 * val);
                    rectangleF2.Y      -= (float)(0.5 * val);
                    rectangleF2.Height += (float)(0.5 * val);
                    graph.DrawRoundedRectShadowAbs(rectangleF2, this.cornerRadius, val, Color.Transparent, Color.FromArgb(175, this.sunken ? Color.White : color), 1f);
                    graph.Clip = clip;
                }
            }
            rectangleF2         = rectangleF;
            rectangleF2.Width  -= (float)(val * 0.30000001192092896);
            rectangleF2.Height -= (float)(val * 0.30000001192092896);
            using (Region region2 = new Region(graph.CreateRoundedRectPath(new RectangleF((float)(rectangleF2.X + val * 0.5), (float)(rectangleF2.Y + val * 0.5), (float)(rectangleF2.Width - 0.20000000298023224 * val), (float)(rectangleF2.Height - 0.20000000298023224 * val)), this.cornerRadius)))
            {
                RectangleF rect2 = rectangleF2;
                rect2.Width  += val;
                rect2.Height += val;
                region2.Complement(graph.CreateRoundedRectPath(rect2, this.cornerRadius));
                region2.Intersect(graph.CreateRoundedRectPath(rectangleF2, this.cornerRadius));
                Region clip2 = graph.Clip;
                graph.Clip = region2;
                graph.DrawRoundedRectShadowAbs(rect2, this.cornerRadius, val, Color.Transparent, Color.FromArgb(175, this.sunken ? color : Color.White), 1f);
                graph.Clip = clip2;
            }
        }
Exemplo n.º 3
0
        private GraphicsPath GetButtonPath(MapGraphics g)
        {
            GraphicsPath graphicsPath = new GraphicsPath();

            switch (this.Style)
            {
            case PanelButtonStyle.Rectangle:
                graphicsPath.AddRectangle(g.GetAbsoluteRectangle(this.Bounds));
                break;

            case PanelButtonStyle.Circle:
                graphicsPath.AddEllipse(g.GetAbsoluteRectangle(this.Bounds));
                break;

            case PanelButtonStyle.RoundedRectangle:
            {
                RectangleF absoluteRectangle = g.GetAbsoluteRectangle(this.Bounds);
                if (!(absoluteRectangle.Width < 1.0) && !(absoluteRectangle.Height < 1.0))
                {
                    float   num          = (float)(absoluteRectangle.Width / 8.0);
                    float[] cornerRadius = new float[8]
                    {
                        num,
                        num,
                        num,
                        num,
                        num,
                        num,
                        num,
                        num
                    };
                    graphicsPath.AddPath(g.CreateRoundedRectPath(absoluteRectangle, cornerRadius), false);
                    break;
                }
                return(graphicsPath);
            }

            case PanelButtonStyle.Triangle:
                switch (this.Type)
                {
                case PanelButtonType.NavigationButton:
                    graphicsPath.AddLines(new PointF[3]
                    {
                        g.GetAbsolutePoint(new PointF(this.Bounds.Left, this.Bounds.Bottom)),
                        g.GetAbsolutePoint(new PointF((float)((this.Bounds.Left + this.Bounds.Right) / 2.0), this.Bounds.Top)),
                        g.GetAbsolutePoint(new PointF(this.Bounds.Right, this.Bounds.Bottom))
                    });
                    graphicsPath.CloseAllFigures();
                    break;

                case PanelButtonType.NaviagateSouth:
                    graphicsPath.AddLines(new PointF[3]
                    {
                        g.GetAbsolutePoint(new PointF(this.Bounds.Left, this.Bounds.Top)),
                        g.GetAbsolutePoint(new PointF((float)((this.Bounds.Left + this.Bounds.Right) / 2.0), this.Bounds.Bottom)),
                        g.GetAbsolutePoint(new PointF(this.Bounds.Right, this.Bounds.Top))
                    });
                    graphicsPath.CloseAllFigures();
                    break;

                case PanelButtonType.NaviagateEast:
                    graphicsPath.AddLines(new PointF[3]
                    {
                        g.GetAbsolutePoint(new PointF(this.Bounds.Left, this.Bounds.Top)),
                        g.GetAbsolutePoint(new PointF(this.Bounds.Right, (float)((this.Bounds.Top + this.Bounds.Bottom) / 2.0))),
                        g.GetAbsolutePoint(new PointF(this.Bounds.Left, this.Bounds.Bottom))
                    });
                    graphicsPath.CloseAllFigures();
                    break;

                case PanelButtonType.NaviagateWest:
                    graphicsPath.AddLines(new PointF[3]
                    {
                        g.GetAbsolutePoint(new PointF(this.Bounds.Right, this.Bounds.Top)),
                        g.GetAbsolutePoint(new PointF(this.Bounds.Left, (float)((this.Bounds.Top + this.Bounds.Bottom) / 2.0))),
                        g.GetAbsolutePoint(new PointF(this.Bounds.Right, this.Bounds.Bottom))
                    });
                    graphicsPath.CloseAllFigures();
                    break;
                }
                break;
            }
            return(graphicsPath);
        }