Beispiel #1
0
        public GraphicsPath GetContourPath(Rectangle bounds)
        {
            GraphicsPath path = new GraphicsPath();

            if (bounds.Height <= 0 || bounds.Width <= 0)
            {
                return(path);
            }
            if (bounds.Height < 10 || bounds.Width < 10)
            {
                RoundRectShape rrs = new RoundRectShape(5);
                path = rrs.CreatePath(bounds);
                return(path);
            }


            GraphicsPath res = new GraphicsPath();

            Point[] points = null;

            if (this.RoundedBottom)
            {
                points = GetRoundedBottomContour(bounds);
            }
            else
            {
                points = GetCutBottomContour(bounds);
            }

            res.AddLines(points);

            return(res);
        }
Beispiel #2
0
        /// <summary>Greates the path.</summary>
        public override GraphicsPath CreatePath(Rectangle bounds)
        {
            GraphicsPath path = new GraphicsPath();

            if (bounds.Height <= 0 || bounds.Width <= 0)
            {
                return(path);
            }
            if (bounds.Height < 10 || bounds.Width < 10)
            {
                RoundRectShape rrs = new RoundRectShape(5);
                path = rrs.CreatePath(bounds);
                return(path);
            }

            Rectangle[] rects = GetRectangles(bounds);
            path.AddRectangles(rects);

            //Point[] points = GetRoundedBottomContour(bounds);
            //path.AddLines(points);

            //path.CloseFigure();

            return(path);
        }
Beispiel #3
0
        private void radGridView1_RowPaint(object sender, GridViewRowPaintEventArgs e)
        {
            if (e.Row is GridDataRowElement)
            {
                GridDataRowElement rowElement = (GridDataRowElement)e.Row;
                int startIndex = (int)e.Row.RowInfo.Cells["StartCell"].Value;
                int endIndex   = (int)e.Row.RowInfo.Cells["EndCell"].Value;
                GridDataCellElement startCell = GetCell(e.Row, startIndex);
                GridDataCellElement endCell   = GetCell(e.Row, endIndex);

                if (startCell != null || endCell != null)
                {
                    int left  = startCell == null ? rowElement.ScrollableColumns.BoundingRectangle.Left - 10 : startCell.ControlBoundingRectangle.Left;
                    int right = endCell == null ? rowElement.ScrollableColumns.BoundingRectangle.Right + 10 : endCell.ControlBoundingRectangle.Right;

                    e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
                    Region clipRegion = e.Graphics.Clip;

                    e.Graphics.SetClip(rowElement.ScrollableColumns.BoundingRectangle);

                    int randomColor = (int)e.Row.RowInfo.Cells["Color"].Value;

                    using (RoundRectShape shape = new RoundRectShape(5))
                        using (GraphicsPath path = shape.CreatePath(new RectangleF(left + 5, 5, (right - left) - 10, e.Row.Size.Height - 10)))
                            using (Brush brush = new SolidBrush(fills[randomColor]))
                                using (Pen pen = new Pen(borders[randomColor], 2))
                                {
                                    e.Graphics.FillPath(brush, path);
                                    e.Graphics.DrawPath(pen, path);
                                }

                    e.Graphics.Clip = clipRegion;
                }
            }
        }