Esempio n. 1
0
        /// <summary>
        /// Handles the Mouse-Up situation.
        /// </summary>
        /// <param name="e">The GeoMouseArcs class describes the mouse condition along with geographic coordinates.</param>
        protected override void OnMouseUp(GeoMouseArgs e)
        {
            if (_standBy)
            {
                return;
            }
            if (_featureSet == null || _featureSet.IsDisposed)
            {
                return;
            }

            // Add the current point to the featureset
            if (_featureSet.FeatureType == FeatureType.Point)
            {
                // Begin snapping changes
                Coordinate snappedCoord = _coordinateDialog.Coordinate;
                ComputeSnappedLocation(e, ref snappedCoord);
                // End snapping changes

                Topology.Point pt = new Topology.Point(snappedCoord); // Snapping changes
                Feature        f  = new Feature(pt);
                _featureSet.Features.Add(f);
                _featureSet.UpdateExtent();
                _featureSet.InvalidateVertices();
                return;
            }

            if (e.Button == MouseButtons.Right)
            {
                _context.Show((Control)Map, e.Location);
            }
            else
            {
                if (_coordinates == null)
                {
                    _coordinates = new List <Coordinate>();
                }

                // Begin snapping changes
                Coordinate snappedCoord = e.GeographicLocation;
                ComputeSnappedLocation(e, ref snappedCoord);
                // End snapping changes

                _coordinates.Add(snappedCoord); // Snapping changes
                if (_coordinates.Count > 1)
                {
                    Point     p1      = Map.ProjToPixel(_coordinates[_coordinates.Count - 1]);
                    Point     p2      = Map.ProjToPixel(_coordinates[_coordinates.Count - 2]);
                    Rectangle invalid = SymbologyGlobal.GetRectangle(p1, p2);
                    invalid.Inflate(20, 20);
                    Map.Invalidate(invalid);
                }
            }

            base.OnMouseUp(e);
        }
Esempio n. 2
0
        /// <summary>
        /// updates the auto-filling X and Y coordinates
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseMove(GeoMouseArgs e)
        {
            if (_standBy)
            {
                return;
            }
            if (_coordinates == null || _coordinates.Count == 0)
            {
                return;
            }
            Coordinate c1 = e.GeographicLocation;

            if (_measureDialog.MeasureMode == MeasureMode.Distance)
            {
                double dist = GetDist(c1);
                _measureDialog.TotalDistance = _previousDistance + _currentDistance + dist;
            }
            else
            {
                List <Coordinate> tempPolygon = _coordinates.ToList();
                tempPolygon.Add(c1);
                if (tempPolygon.Count < 3)
                {
                    if (tempPolygon.Count == 2)
                    {
                        Rectangle r = Map.ProjToPixel(new LineString(tempPolygon).Envelope.ToExtent());
                        r.Inflate(20, 20);
                        Map.Invalidate(r);
                    }
                    _mousePosition = e.Location;
                    return;
                }
                Polygon pg = new Polygon(new LinearRing(tempPolygon));

                double area = GetArea(tempPolygon);

                _measureDialog.TotalArea = area;
                Rectangle rr = Map.ProjToPixel(pg.Envelope.ToExtent());
                rr.Inflate(20, 20);
                Map.Invalidate(rr);
                _mousePosition = e.Location;
            }

            if (_coordinates.Count > 0)
            {
                List <Point> points  = _coordinates.Select(coord => Map.ProjToPixel(coord)).ToList();
                Rectangle    oldRect = SymbologyGlobal.GetRectangle(_mousePosition, points[points.Count - 1]);
                Rectangle    newRect = SymbologyGlobal.GetRectangle(e.Location, points[points.Count - 1]);
                Rectangle    invalid = Rectangle.Union(newRect, oldRect);
                invalid.Inflate(20, 20);
                Map.Invalidate(invalid);
            }
            _mousePosition = e.Location;
            base.OnMouseMove(e);
        }
Esempio n. 3
0
 /// <summary>
 /// Creates a new instance of ColorLever
 /// </summary>
 public ColorLever()
 {
     _color       = SymbologyGlobal.RandomLightColor(1F);
     _borderWidth = 5;
     _knobRadius  = 7;
     _barLength   = 5;
     _barWidth    = 5;
     _knobColor   = Color.SteelBlue;
     _ttHelp      = new ToolTip();
     _ttHelp.SetToolTip(this, "Click to change the color, or rotate the lever to control opacity.");
 }
Esempio n. 4
0
 /// <summary>
 /// Creates a Gradient Brush
 /// </summary>
 /// <param name="color"></param>
 /// <param name="topLeft"></param>
 /// <param name="bottomRight"></param>
 /// <returns></returns>
 protected static LinearGradientBrush CreateGradientBrush(Color color, PointF topLeft, PointF bottomRight)
 {
     float b = color.GetBrightness();
     b += .3F;
     if (b > 1F) b = 1F;
     Color light = SymbologyGlobal.ColorFromHsl(color.GetHue(), color.GetSaturation(), b);
     float d = color.GetBrightness();
     d -= .3F;
     if (d < 0F) d = 0F;
     Color dark = SymbologyGlobal.ColorFromHsl(color.GetHue(), color.GetSaturation(), d);
     return new LinearGradientBrush(topLeft, bottomRight, light, dark);
 }
Esempio n. 5
0
        /// <summary>
        /// Controls the actual drawing for this gradient slider control.
        /// </summary>
        /// <param name="g">The graphics object used for drawing.</param>
        /// <param name="clipRectangle">The clip rectangle.</param>
        protected virtual void OnDraw(Graphics g, Rectangle clipRectangle)
        {
            using (GraphicsPath gp = new())
            {
                Rectangle innerRect = new(LeftHandle.Width, 3, Width - 1 - RightHandle.Width - LeftHandle.Width, Height - 1 - 6);
                gp.AddRoundedRectangle(innerRect, 2);

                if (Width == 0 || Height == 0)
                {
                    return;
                }

                // Create a rounded gradient effect as the backdrop that other colors will be drawn to
                LinearGradientBrush silver = new(ClientRectangle, BackColor.Lighter(.2F), BackColor.Darker(.6F), LinearGradientMode.Vertical);
                g.FillPath(silver, gp);
                silver.Dispose();

                using (LinearGradientBrush lgb = new(innerRect, Color.White, Color.White, LinearGradientMode.Horizontal))
                {
                    Color[] colors    = new Color[37];
                    float[] positions = new float[37];

                    for (int i = 0; i <= 36; i++)
                    {
                        int j = _inverted ? 36 - i : i;
                        colors[j]    = SymbologyGlobal.ColorFromHsl(((i * 10) + _hueShift) % 360, 1, .7).ToTransparent(.7f);
                        positions[i] = i / 36f;
                    }

                    ColorBlend cb = new()
                    {
                        Colors    = colors,
                        Positions = positions
                    };
                    lgb.InterpolationColors = cb;
                    g.FillPath(lgb, gp);
                }

                g.DrawPath(Pens.Gray, gp);
            }

            if (Enabled)
            {
                LeftHandle.Draw(g);
                RightHandle.Draw(g);
            }
        }
        /// <summary>
        ///  鼠标移动
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseMove(GeoMouseArgs e)
        {
            //注销后直接跳过
            if (_standBy)
            {
                return;
            }

            //当无坐标时
            if (coordinates == null || coordinates.Count == 0)
            {
                return;
            }
            //鼠标位置点
            Coordinate c1 = e.GeographicLocation;

            //鼠标和最后一个点的距离
            double dist = GetDist(c1, null);

            tempDistance = currentDistance + dist;

            //当点数量大于0时
            if (coordinates.Count > 0)
            {
                //将地理坐标转为屏幕坐标
                List <Point> points = coordinates.Select(coord => Map.ProjToPixel(coord)).ToList();

                //获取鼠标上一个位置和最后一个点的矩形区域
                Rectangle oldRect = SymbologyGlobal.GetRectangle(_mousePosition, points[points.Count - 1]);

                //获取鼠标和左后一个点的矩形区域
                Rectangle newRect = SymbologyGlobal.GetRectangle(e.Location, points[points.Count - 1]);

                //合并区域
                Rectangle invalid = Rectangle.Union(newRect, oldRect);

                //刷新区域
                invalid.Inflate(220, 20);

                Map.Invalidate(invalid);
            }

            //设置为鼠标位置
            _mousePosition = e.Location;

            base.OnMouseMove(e);
        }
Esempio n. 7
0
        // a good selectionHighlight color: 215, 238, 252
        private Brush HighlightBrush(Rectangle box)
        {
            float med    = _selectionHighlight.GetBrightness();
            float bright = med + 0.05f;

            if (bright > 1f)
            {
                bright = 1f;
            }
            float dark = med - 0.05f;

            if (dark < 0f)
            {
                dark = 0f;
            }
            Color brtCol = SymbologyGlobal.ColorFromHsl(_selectionHighlight.GetHue(), _selectionHighlight.GetSaturation(), bright);
            Color drkCol = SymbologyGlobal.ColorFromHsl(_selectionHighlight.GetHue(), _selectionHighlight.GetSaturation(), dark);

            return(new LinearGradientBrush(box, brtCol, drkCol, LinearGradientMode.Vertical));
        }
Esempio n. 8
0
        /// <summary>
        /// Occurs during the drawing of an item.
        /// </summary>
        /// <param name="e">The event args.</param>
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            Rectangle outer = e.Bounds;

            outer.Inflate(1, 1);
            e.Graphics.FillRectangle(Brushes.White, outer);
            Brush fontBrush = Brushes.Black;

            if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
            {
                Rectangle r = e.Bounds;
                r.Inflate(-1, -1);
                e.Graphics.FillRectangle(SymbologyGlobal.HighlightBrush(r, Color.FromArgb(215, 238, 252)), r);
                Pen p = new(Color.FromArgb(215, 238, 252));
                SymbologyGlobal.DrawRoundedRectangle(e.Graphics, p, e.Bounds);
                p.Dispose();
            }

            string     name = Items[e.Index].ToString();
            FontFamily ff   = new(name);
            Font       fnt  = new("Arial", 10, FontStyle.Regular);

            if (ff.IsStyleAvailable(FontStyle.Regular))
            {
                fnt = new Font(name, 10, FontStyle.Regular);
            }
            else if (ff.IsStyleAvailable(FontStyle.Italic))
            {
                fnt = new Font(name, 10, FontStyle.Italic);
            }

            SizeF box = e.Graphics.MeasureString(name, Font);

            e.Graphics.DrawString(name, Font, fontBrush, e.Bounds.X, e.Bounds.Y);
            e.Graphics.DrawString("ABC", fnt, fontBrush, e.Bounds.X + box.Width, e.Bounds.Y);
        }
Esempio n. 9
0
        protected virtual PointF OnInitializeItem(DrawLegendItemArgs e)
        {
            if (e.Item.LegendItemVisible == false)
            {
                return(e.TopLeft);
            }

            UpdateActions(e.Item);

            PointF topLeft     = e.TopLeft;
            PointF tempTopLeft = topLeft;

            if (topLeft.Y > ControlRectangle.Bottom)
            {
                return(topLeft); // drawing would be below the screen
            }
            if (topLeft.Y > ControlRectangle.Top - ItemHeight)
            {
                // Draw the item itself
                // Point tl = new Point((int)topLeft.X, (int)topLeft.Y);
                var itemBox = new LegendBox();
                _legendBoxes.Add(itemBox);
                itemBox.Item   = e.Item;
                itemBox.Bounds = new Rectangle(0, (int)topLeft.Y, Width, ItemHeight);
                itemBox.Indent = (int)topLeft.X / _indentation;

                DrawPlusMinus(e.Graphics, ref tempTopLeft, itemBox);

                int ih = ItemHeight;

                if (e.Item.LegendSymbolMode == SymbolMode.Symbol)
                {
                    Size s = e.Item.GetLegendSymbolSize();
                    if (s.Height > ih)
                    {
                        tempTopLeft.Y += 3;
                    }
                }
                if (e.Item.LegendSymbolMode == SymbolMode.Symbol || e.Item.LegendSymbolMode == SymbolMode.GroupSymbol)
                {
                    DrawSymbol(e.Graphics, ref tempTopLeft, itemBox);
                }

                if (e.Item.LegendSymbolMode == SymbolMode.Checkbox)
                {
                    DrawCheckBoxes(e.Graphics, ref tempTopLeft, itemBox);
                }

                int width = (int)e.Graphics.MeasureString(e.Item.LegendText, Font).Width;
                int dY    = 0;
                if (e.Item.LegendSymbolMode == SymbolMode.Symbol)
                {
                    Size s = e.Item.GetLegendSymbolSize();
                    if (s.Height > ih)
                    {
                        dY = (s.Height - ih) / 2;
                    }
                    tempTopLeft.Y += dY;
                }
                tempTopLeft.Y += (ih - Font.Height) / (float)2;

                itemBox.Textbox = new Rectangle((int)tempTopLeft.X, (int)topLeft.Y + dY, width, ItemHeight);
                if (itemBox.Item.IsSelected)
                {
                    _selection.Add(itemBox.Item);
                    Rectangle innerBox = itemBox.Textbox;
                    innerBox.Inflate(-1, -1);
                    using (var b = HighlightBrush(innerBox))
                    {
                        e.Graphics.FillRectangle(b, innerBox);
                    }

                    SymbologyGlobal.DrawRoundedRectangle(e.Graphics, _highlightBorderPen, itemBox.Textbox);
                    e.Graphics.DrawString(e.Item.LegendText, Font, _selectionFontBrush, tempTopLeft);
                }
                else
                {
                    e.Graphics.DrawString(e.Item.LegendText, Font, Brushes.Black, tempTopLeft);
                }
            }
            int h = ItemHeight;

            if (e.Item.LegendSymbolMode == SymbolMode.Symbol)
            {
                Size s = e.Item.GetLegendSymbolSize();
                if (s.Height > h)
                {
                    h = s.Height + 6;
                }
            }
            topLeft.Y += h;

            if (e.Item.IsExpanded)
            {
                topLeft.X += _indentation;
                if (e.Item.LegendItems != null)
                {
                    List <ILegendItem> items = e.Item.LegendItems.ToList();
                    if (e.Item is IGroup)
                    {
                        items.Reverse();                   // reverse layers because of drawing order, don't bother reversing categories.
                    }
                    foreach (var item in items)
                    {
                        var args = new DrawLegendItemArgs(e.Graphics, item, e.ClipRectangle, topLeft);
                        topLeft = OnInitializeItem(args);
                        if (topLeft.Y > ControlRectangle.Bottom)
                        {
                            break;
                        }
                    }
                }
                topLeft.X -= _indentation;
            }
            return(topLeft);
        }
Esempio n. 10
0
        /// <summary>
        /// updates the auto-filling X and Y coordinates.
        /// </summary>
        /// <param name="e">the event args.</param>
        protected override void OnMouseMove(GeoMouseArgs e)
        {
            if (_standBy)
            {
                return;
            }

            if (_coordinates == null || _coordinates.Count == 0)
            {
                return;
            }

            Coordinate c1 = e.GeographicLocation;

            if (_measureDialog.MeasureMode == MeasureMode.Distance)
            {
                double dist = GetDist(c1);
                _measureDialog.TotalDistance = _previousDistance + _currentDistance + dist;
            }
            else
            {
                List <Coordinate> tempPolygon = _coordinates.ToList();
                if (!c1.Equals2D(_coordinates[_coordinates.Count - 1]))
                {
                    tempPolygon.Add(c1);                                                     // don't add the current coordinate again if it was added by mouse click
                }
                if (tempPolygon.Count < 3)
                {
                    if (tempPolygon.Count > 1)
                    {
                        Rectangle r = Map.ProjToPixel(new LineString(tempPolygon.ToArray()).EnvelopeInternal.ToExtent());
                        r.Inflate(20, 20);
                        Map.Invalidate(r);
                    }

                    _mousePosition = e.Location;
                    return;
                }

                tempPolygon.Add(_coordinates[0]); // changed by jany_ (2016-06-09) close the polygon, because they must be closed by definition
                Polygon pg = new Polygon(new LinearRing(tempPolygon.ToArray()));

                double area = GetArea(tempPolygon.ToArray());

                _measureDialog.TotalArea = area;
                Rectangle rr = Map.ProjToPixel(pg.EnvelopeInternal.ToExtent());
                rr.Inflate(20, 20);
                Map.Invalidate(rr);
                _mousePosition = e.Location;
            }

            if (_coordinates.Count > 0)
            {
                List <Point> points  = _coordinates.Select(coord => Map.ProjToPixel(coord)).ToList();
                Rectangle    oldRect = SymbologyGlobal.GetRectangle(_mousePosition, points[points.Count - 1]);
                Rectangle    newRect = SymbologyGlobal.GetRectangle(e.Location, points[points.Count - 1]);
                Rectangle    invalid = Rectangle.Union(newRect, oldRect);
                invalid.Inflate(20, 20);
                Map.Invalidate(invalid);
            }

            _mousePosition = e.Location;
            base.OnMouseMove(e);
        }
Esempio n. 11
0
        /// <summary>
        /// Repaints the form with cool background and stuff
        /// </summary>
        /// <param name="graph">The graphics object to paint to, the element will be drawn to 0, 0</param>
        public virtual void Paint(Graphics graph)
        {
            //Sets up the colors to use
            Pen   outlinePen     = new Pen(SymbologyGlobal.ColorFromHsl(Color.GetHue(), Color.GetSaturation(), Color.GetBrightness() * 0.6 * Highlight), 1.75F);
            Color gradientTop    = SymbologyGlobal.ColorFromHsl(Color.GetHue(), Color.GetSaturation(), Color.GetBrightness() * 0.7 * Highlight);
            Color gradientBottom = SymbologyGlobal.ColorFromHsl(Color.GetHue(), Color.GetSaturation(), Color.GetBrightness() * 1.0 * Highlight);

            //The path used for drop shadows
            GraphicsPath shadowPath = new GraphicsPath();
            ColorBlend   colorBlend = new ColorBlend(3);

            colorBlend.Colors    = new[] { Color.Transparent, Color.FromArgb(180, Color.DarkGray), Color.FromArgb(180, Color.DimGray) };
            colorBlend.Positions = new[] { 0f, 0.125f, 1f };

            //Draws Rectangular Shapes
            if (Shape == ModelShape.Rectangle)
            {
                //Draws the shadow
                shadowPath.AddPath(GetRoundedRect(new Rectangle(5, 5, Width, Height), 10), true);
                PathGradientBrush shadowBrush = new PathGradientBrush(shadowPath);
                shadowBrush.WrapMode            = WrapMode.Clamp;
                shadowBrush.InterpolationColors = colorBlend;
                graph.FillPath(shadowBrush, shadowPath);

                //Draws the basic shape
                Rectangle           fillRectange = new Rectangle(0, 0, Width - 5, Height - 5);
                GraphicsPath        fillArea     = GetRoundedRect(fillRectange, 5);
                LinearGradientBrush myBrush      = new LinearGradientBrush(fillRectange, gradientBottom, gradientTop, LinearGradientMode.Vertical);
                graph.FillPath(myBrush, fillArea);
                graph.DrawPath(outlinePen, fillArea);

                //Draws the status light
                DrawStatusLight(graph);

                //Draws the text
                SizeF      textSize = graph.MeasureString(Name, Font, Width);
                RectangleF textRect;
                if ((textSize.Width < Width) || (textSize.Height < Height))
                {
                    textRect = new RectangleF((Width - textSize.Width) / 2, (Height - textSize.Height) / 2, textSize.Width, textSize.Height);
                }
                else
                {
                    textRect = new RectangleF(0, (Height - textSize.Height) / 2, Width, textSize.Height);
                }
                graph.DrawString(Name, Font, new SolidBrush(Color.FromArgb(50, Color.Black)), textRect);
                textRect.X = textRect.X - 1;
                textRect.Y = textRect.Y - 1;
                graph.DrawString(Name, Font, Brushes.Black, textRect);

                //Garbage collection
                fillArea.Dispose();
                myBrush.Dispose();
            }

            //Draws Ellipse Shapes
            if (_shape == ModelShape.Ellipse)
            {
                //Draws the shadow
                shadowPath.AddEllipse(0, 5, Width + 5, Height);
                PathGradientBrush shadowBrush = new PathGradientBrush(shadowPath);
                shadowBrush.WrapMode            = WrapMode.Clamp;
                shadowBrush.InterpolationColors = colorBlend;
                graph.FillPath(shadowBrush, shadowPath);

                //Draws the Ellipse
                Rectangle           fillArea = new Rectangle(0, 0, Width, Height);
                LinearGradientBrush myBrush  = new LinearGradientBrush(fillArea, gradientBottom, gradientTop, LinearGradientMode.Vertical);
                graph.FillEllipse(myBrush, 1, 1, Width - 5, Height - 5);
                graph.DrawEllipse(outlinePen, 1, 1, Width - 5, Height - 5);

                //Draws the text
                SizeF      textSize = graph.MeasureString(_name, _font, Width);
                RectangleF textRect;
                if ((textSize.Width < Width) || (textSize.Height < Height))
                {
                    textRect = new RectangleF((Width - textSize.Width) / 2, (Height - textSize.Height) / 2, textSize.Width, textSize.Height);
                }
                else
                {
                    textRect = new RectangleF(0, (Height - textSize.Height) / 2, Width, textSize.Height);
                }
                graph.DrawString(Name, Font, new SolidBrush(Color.FromArgb(50, Color.Black)), textRect);
                textRect.X = textRect.X - 1;
                textRect.Y = textRect.Y - 1;
                graph.DrawString(Name, Font, Brushes.Black, textRect);

                //Garbage collection
                myBrush.Dispose();
            }

            //Draws Triangular Shapes
            if (_shape == ModelShape.Triangle)
            {
                //Draws the shadow
                Point[] ptShadow = new Point[4];
                ptShadow[0] = new Point(5, 5);
                ptShadow[1] = new Point(Width + 5, ((Height - 5) / 2) + 5);
                ptShadow[2] = new Point(5, Height + 2);
                ptShadow[3] = new Point(5, 5);
                shadowPath.AddLines(ptShadow);
                PathGradientBrush shadowBrush = new PathGradientBrush(shadowPath);
                shadowBrush.WrapMode            = WrapMode.Clamp;
                shadowBrush.InterpolationColors = colorBlend;
                graph.FillPath(shadowBrush, shadowPath);

                //Draws the shape
                Point[] pt = new Point[4];
                pt[0] = new Point(0, 0);
                pt[1] = new Point(Width - 5, (Height - 5) / 2);
                pt[2] = new Point(0, Height - 5);
                pt[3] = new Point(0, 0);
                GraphicsPath myPath = new GraphicsPath();
                myPath.AddLines(pt);
                Rectangle           fillArea = new Rectangle(1, 1, Width - 5, Height - 5);
                LinearGradientBrush myBrush  = new LinearGradientBrush(fillArea, gradientBottom, gradientTop, LinearGradientMode.Vertical);
                graph.FillPath(myBrush, myPath);
                graph.DrawPath(outlinePen, myPath);

                //Draws the text
                SizeF      textSize = graph.MeasureString(Name, Font, Width);
                RectangleF textRect;
                if ((textSize.Width < Width) || (textSize.Height < Height))
                {
                    textRect = new RectangleF((Width - textSize.Width) / 2, (Height - textSize.Height) / 2, textSize.Width, textSize.Height);
                }
                else
                {
                    textRect = new RectangleF(0, (Height - textSize.Height) / 2, Width, textSize.Height);
                }
                graph.DrawString(Name, Font, Brushes.Black, textRect);

                //Garbage collection
                myBrush.Dispose();
            }

            //Garbage collection
            shadowPath.Dispose();
            outlinePen.Dispose();
        }
Esempio n. 12
0
        /// <summary>
        /// This supplies the basic drawing for this one element where the graphics object has been transformed
        /// based on the position of this item.
        /// </summary>
        /// <param name="e">A PaintEventArgs that contains the Graphics object needed for drawing.</param>
        protected virtual void OnDraw(PaintEventArgs e)
        {
            //System.Diagnostics.Debug.WriteLine("top: " + this.Top.ToString());
            int   left           = 1;
            Pen   border         = Pens.White;
            Pen   innerBorder    = Pens.White;
            Brush fill           = Brushes.White;
            Pen   dots           = new Pen(Color.Black);
            bool  specialDrawing = false;

            dots.DashStyle = DashStyle.Dot;
            if (_isHighlighted && _isSelected == false)
            {
                border         = new Pen(Color.FromArgb(216, 240, 250));
                innerBorder    = new Pen(Color.FromArgb(248, 252, 254));
                fill           = new LinearGradientBrush(ClientRectangle, Color.FromArgb(245, 250, 253), Color.FromArgb(232, 245, 253), LinearGradientMode.Vertical);
                specialDrawing = true;
            }
            if (_isSelected && _isHighlighted == false)
            {
                border         = new Pen(Color.FromArgb(153, 222, 253));
                innerBorder    = new Pen(Color.FromArgb(231, 245, 253));
                fill           = new LinearGradientBrush(ClientRectangle, Color.FromArgb(241, 248, 253), Color.FromArgb(213, 239, 252), LinearGradientMode.Vertical);
                specialDrawing = true;
            }
            if (_isSelected && _isHighlighted)
            {
                border         = new Pen(Color.FromArgb(182, 230, 251));
                innerBorder    = new Pen(Color.FromArgb(242, 249, 253));
                fill           = new LinearGradientBrush(ClientRectangle, Color.FromArgb(232, 246, 253), Color.FromArgb(196, 232, 250), LinearGradientMode.Vertical);
                specialDrawing = true;
            }

            e.Graphics.FillRectangle(fill, new Rectangle(1, 1, Width - 2, Height - 2));
            SymbologyGlobal.DrawRoundedRectangle(e.Graphics, innerBorder, new Rectangle(2, 2, Width - 4, Height - 4));
            SymbologyGlobal.DrawRoundedRectangle(e.Graphics, border, new Rectangle(1, 1, Width - 2, Height - 2));

            if (_isOutlined)
            {
                e.Graphics.DrawRectangle(dots, new Rectangle(2, 2, Width - 4, Height - 4));
            }

            if (_showImage)
            {
                if (Height > 20)
                {
                    e.Graphics.DrawImage(Image, new Rectangle(1, 1, Height - 2, Height - 2));
                }
                else
                {
                    e.Graphics.DrawImage(Image, new Rectangle(1, 1, Image.Width, Image.Height));
                }
                left = Height + 2;
            }
            Brush b = new SolidBrush(_fontColor);

            e.Graphics.DrawString(Text, Font, b, new PointF(left, 1f));
            b.Dispose();

            if (specialDrawing)
            {
                if (border != null)
                {
                    border.Dispose();
                }
                if (innerBorder != null)
                {
                    innerBorder.Dispose();
                }
                if (fill != null)
                {
                    fill.Dispose();
                }
                if (dots != null)
                {
                    dots.Dispose();
                }
            }

            //base.OnPaint(e);
        }