示例#1
0
        internal virtual void RenderBorder(MapGraphics g)
        {
            AntiAliasing antiAliasing = g.AntiAliasing;

            g.AntiAliasing = AntiAliasing.None;
            RectangleF absoluteRectangle = g.GetAbsoluteRectangle(new RectangleF(0f, 0f, 100f, 100f));

            absoluteRectangle.X      = (float)Math.Round(absoluteRectangle.X);
            absoluteRectangle.Y      = (float)Math.Round(absoluteRectangle.Y);
            absoluteRectangle.Width  = (float)Math.Round(absoluteRectangle.Width);
            absoluteRectangle.Height = (float)Math.Round(absoluteRectangle.Height);
            try
            {
                if (BorderWidth <= 0 || BorderColor.IsEmpty || BorderStyle == MapDashStyle.None)
                {
                    return;
                }
                using (Pen pen = new Pen(BorderColor, BorderWidth))
                {
                    pen.DashStyle = MapGraphics.GetPenStyle(BorderStyle);
                    pen.Alignment = PenAlignment.Inset;
                    if (BorderWidth == 1)
                    {
                        absoluteRectangle.Width  -= 1f;
                        absoluteRectangle.Height -= 1f;
                    }
                    g.DrawRectangle(pen, absoluteRectangle.X, absoluteRectangle.Y, absoluteRectangle.Width, absoluteRectangle.Height);
                }
            }
            finally
            {
                g.AntiAliasing = antiAliasing;
            }
        }
示例#2
0
        public virtual void RenderBorder(MapGraphics g)
        {
            AntiAliasing antiAliasing = g.AntiAliasing;

            g.AntiAliasing = AntiAliasing.None;
            RectangleF absoluteRectangle = g.GetAbsoluteRectangle(new RectangleF(0f, 0f, 100f, 100f));

            absoluteRectangle.X      = (float)Math.Round((double)absoluteRectangle.X);
            absoluteRectangle.Y      = (float)Math.Round((double)absoluteRectangle.Y);
            absoluteRectangle.Width  = (float)Math.Round((double)absoluteRectangle.Width);
            absoluteRectangle.Height = (float)Math.Round((double)absoluteRectangle.Height);
            try
            {
                if (this.BorderWidth > 0 && !this.BorderColor.IsEmpty && this.BorderStyle != 0)
                {
                    using (Pen pen = new Pen(this.BorderColor, (float)this.BorderWidth))
                    {
                        pen.DashStyle = MapGraphics.GetPenStyle(this.BorderStyle);
                        pen.Alignment = PenAlignment.Inset;
                        if (this.BorderWidth == 1)
                        {
                            absoluteRectangle.Width  -= 1f;
                            absoluteRectangle.Height -= 1f;
                        }
                        g.DrawRectangle(pen, absoluteRectangle.X, absoluteRectangle.Y, absoluteRectangle.Width, absoluteRectangle.Height);
                    }
                }
            }
            finally
            {
                g.AntiAliasing = antiAliasing;
            }
        }
示例#3
0
        internal override void RenderBorder(MapGraphics g)
        {
            AntiAliasing antiAliasing = g.AntiAliasing;

            g.AntiAliasing = AntiAliasing.None;
            RectangleF rectangleF = new RectangleF(GetAbsoluteLocation(), GetAbsoluteSize());

            rectangleF.X      = (float)Math.Round(rectangleF.X);
            rectangleF.Y      = (float)Math.Round(rectangleF.Y);
            rectangleF.Width  = (float)Math.Round(rectangleF.Width);
            rectangleF.Height = (float)Math.Round(rectangleF.Height);
            if (!(rectangleF.Width > 0f) || !(rectangleF.Height > 0f))
            {
                return;
            }
            try
            {
                if (BorderWidth <= 0 || BorderColor.IsEmpty || BorderStyle == MapDashStyle.None)
                {
                    return;
                }
                using (Pen pen = new Pen(BorderColor, BorderWidth))
                {
                    pen.DashStyle = MapGraphics.GetPenStyle(BorderStyle);
                    pen.Alignment = PenAlignment.Inset;
                    if (BorderWidth == 1)
                    {
                        rectangleF.Width  -= 1f;
                        rectangleF.Height -= 1f;
                    }
                    g.DrawRectangle(pen, rectangleF.X, rectangleF.Y, rectangleF.Width, rectangleF.Height);
                }
            }
            finally
            {
                g.AntiAliasing = antiAliasing;
            }
        }
        public override void RenderBorder(MapGraphics g)
        {
            AntiAliasing antiAliasing = g.AntiAliasing;

            g.AntiAliasing = AntiAliasing.None;
            RectangleF rectangleF = new RectangleF(base.GetAbsoluteLocation(), base.GetAbsoluteSize());

            rectangleF.X      = (float)Math.Round((double)rectangleF.X);
            rectangleF.Y      = (float)Math.Round((double)rectangleF.Y);
            rectangleF.Width  = (float)Math.Round((double)rectangleF.Width);
            rectangleF.Height = (float)Math.Round((double)rectangleF.Height);
            if (rectangleF.Width > 0.0 && rectangleF.Height > 0.0)
            {
                try
                {
                    if (this.BorderWidth > 0 && !this.BorderColor.IsEmpty && this.BorderStyle != 0)
                    {
                        using (Pen pen = new Pen(this.BorderColor, (float)this.BorderWidth))
                        {
                            pen.DashStyle = MapGraphics.GetPenStyle(this.BorderStyle);
                            pen.Alignment = PenAlignment.Inset;
                            if (this.BorderWidth == 1)
                            {
                                rectangleF.Width  -= 1f;
                                rectangleF.Height -= 1f;
                            }
                            g.DrawRectangle(pen, rectangleF.X, rectangleF.Y, rectangleF.Width, rectangleF.Height);
                        }
                    }
                }
                finally
                {
                    g.AntiAliasing = antiAliasing;
                }
            }
        }