Ejemplo n.º 1
0
        /// <summary>
        /// Draw the cell specified
        /// </summary>
        /// <param name="cellContext"></param>
        /// <param name="graphics">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle where draw the current cell</param>
        public void DrawCell(CellContext cellContext,
                             DevAge.Drawing.GraphicsCache graphics,
                             RectangleF rectangle)
        {
            PrepareView(cellContext);

            Draw(graphics, rectangle);
        }
Ejemplo n.º 2
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            using (DevAge.Drawing.GraphicsCache cache = new DevAge.Drawing.GraphicsCache(e.Graphics, e.ClipRectangle))
            {
                //[email protected]: as the IBorder Draw method was changed to add the
                //part of border which needs to be drawn. Change needs to be reflected here as well
                mEditablePanel.Draw(cache, ClientRectangle, BorderPartType.All);
            }
        }
Ejemplo n.º 3
0
        protected override void PaintCell(DevAge.Drawing.GraphicsCache graphics, CellContext cellContext, RectangleF drawRectangle)
        {
            Range cellRange = PositionToCellRange(cellContext.Position);

            if (cellRange.ColumnsCount == 1 && cellRange.RowsCount == 1)
            {
                base.PaintCell(graphics, cellContext, drawRectangle);
            }
            else //Row/Col Span > 1
            {
                // I draw the merged cell only if not already drawn otherwise
                // drawing the same cell can cause some problem when using
                // special drawing code (for example semi transparent background)
                if (mDrawnRange.Contains(cellRange) == false)
                {
                    //[email protected]: painting merged cell depends on scrolling technique
                    ScrollingStyle.PaintMergedCell(graphics, cellRange, cellContext);
                    mDrawnRange.Add(cellRange);
                }
            }
        }
Ejemplo n.º 4
0
 public MeasureHelper(GraphicsCache graphics)
 {
     mGraphics   = graphics.Graphics;
     mDisposeObj = false;
 }
Ejemplo n.º 5
0
        //public void Draw(GraphicsCache graphics, RectangleF rectangle)
        //{
        //    RectangleBorder border = this;

        //    //Calculate the padding
        //    rectangle = new RectangleF(rectangle.X + Left.Padding, rectangle.Y + Top.Padding, rectangle.Width - (Left.Padding + Right.Padding), rectangle.Height - (Top.Padding + Bottom.Padding));

        //    if (rectangle.Width <= 0 || rectangle.Height <= 0)
        //        return;

        //    PensCache pens = graphics.PensCache;
        //    if (border.Left.Width > 0)
        //    {
        //        Pen leftPen = pens.GetPen(border.Left.Color, 1, border.Left.DashStyle);
        //        for (int i = 0; i < border.Left.Width; i++)
        //            graphics.Graphics.DrawLine(leftPen, rectangle.X + i, rectangle.Y, rectangle.X + i, rectangle.Bottom - 1);
        //    }

        //    if (border.Bottom.Width > 0)
        //    {
        //        Pen bottomPen = pens.GetPen(border.Bottom.Color, 1, border.Bottom.DashStyle);
        //        for (int i = 1; i <= border.Bottom.Width; i++)
        //            graphics.Graphics.DrawLine(bottomPen, rectangle.X, rectangle.Bottom - i, rectangle.Right - 1, rectangle.Bottom - i);
        //    }

        //    if (border.Right.Width > 0)
        //    {
        //        Pen rightPen = pens.GetPen(border.Right.Color, 1, border.Right.DashStyle);
        //        for (int i = 1; i <= border.Right.Width; i++)
        //            graphics.Graphics.DrawLine(rightPen, rectangle.Right - i, rectangle.Y, rectangle.Right - i, rectangle.Bottom - 1);
        //    }

        //    if (border.Top.Width > 0)
        //    {
        //        Pen topPen = pens.GetPen(border.Top.Color, 1, border.Top.DashStyle);
        //        for (int i = 0; i < border.Top.Width; i++)
        //            graphics.Graphics.DrawLine(topPen, rectangle.X, rectangle.Y + i, rectangle.Right - 1, rectangle.Y + i);
        //    }
        //}

        public void Draw(GraphicsCache graphics, RectangleF rectangle)
        {
            RectangleBorder border = this;

            //Calculate the padding
            rectangle = new RectangleF(rectangle.X + Left.Padding, rectangle.Y + Top.Padding, rectangle.Width - (Left.Padding + Right.Padding), rectangle.Height - (Top.Padding + Bottom.Padding));

            if (rectangle.Width <= 0 || rectangle.Height <= 0)
                return;

            PensCache pens = graphics.PensCache;
            if (border.Left.Width > 0)
            {
                Pen leftPen = pens.GetPen(border.Left.Color, border.Left.Width, border.Left.DashStyle);
                float x;
                float bottom;
                if (border.Left.Width > 1)
                {
                    x = rectangle.X + ((float)border.Left.Width) / 2;
                    bottom = rectangle.Bottom;
                }
                else
                {
                    x = rectangle.X;
                    bottom = rectangle.Bottom - 1;
                }
                graphics.Graphics.DrawLine(leftPen, new PointF(x, rectangle.Y),
                                                    new PointF(x, bottom));
            }

            if (border.Right.Width > 0)
            {
                Pen rightPen = pens.GetPen(border.Right.Color, border.Right.Width, border.Right.DashStyle);
                float x;
                float bottom;
                if (border.Right.Width > 1)
                {
                    x = rectangle.Right - border.Right.Width / 2;
                    bottom = rectangle.Bottom;
                }
                else
                {
                    x = rectangle.Right - 1;
                    bottom = rectangle.Bottom - 1;
                }
                graphics.Graphics.DrawLine(rightPen, new PointF(x, rectangle.Y),
                                                    new PointF(x, bottom));
            }

            if (border.Top.Width > 0)
            {
                Pen topPen = pens.GetPen(border.Top.Color, border.Top.Width, border.Top.DashStyle);
                float y;
                float right;
                if (border.Top.Width > 1)
                {
                    y = rectangle.Y + border.Top.Width / 2;
                    right = rectangle.Right;
                }
                else
                {
                    y = rectangle.Y;
                    right = rectangle.Right - 1;
                }
                graphics.Graphics.DrawLine(topPen, new PointF(rectangle.X, y),
                                                   new PointF(right, y));
            }

            if (border.Bottom.Width > 0)
            {
                Pen bottomPen = pens.GetPen(border.Bottom.Color, border.Bottom.Width, border.Bottom.DashStyle);
                float y;
                float right;
                if (border.Bottom.Width > 1)
                {
                    y = rectangle.Bottom - border.Bottom.Width / 2;
                    right = rectangle.Right;
                }
                else
                {
                    y = rectangle.Bottom - 1;
                    right = rectangle.Right - 1;
                }
                graphics.Graphics.DrawLine(bottomPen, new PointF(rectangle.X, y),
                                                      new PointF(right, y));
            }
        }
Ejemplo n.º 6
0
        //public void Draw(GraphicsCache graphics, RectangleF rectangle)
        //{
        //    RectangleBorder border = this;

        //    //Calculate the padding
        //    rectangle = new RectangleF(rectangle.X + Left.Padding, rectangle.Y + Top.Padding, rectangle.Width - (Left.Padding + Right.Padding), rectangle.Height - (Top.Padding + Bottom.Padding));

        //    if (rectangle.Width <= 0 || rectangle.Height <= 0)
        //        return;

        //    PensCache pens = graphics.PensCache;
        //    if (border.Left.Width > 0)
        //    {
        //        Pen leftPen = pens.GetPen(border.Left.Color, 1, border.Left.DashStyle);
        //        for (int i = 0; i < border.Left.Width; i++)
        //            graphics.Graphics.DrawLine(leftPen, rectangle.X + i, rectangle.Y, rectangle.X + i, rectangle.Bottom - 1);
        //    }

        //    if (border.Bottom.Width > 0)
        //    {
        //        Pen bottomPen = pens.GetPen(border.Bottom.Color, 1, border.Bottom.DashStyle);
        //        for (int i = 1; i <= border.Bottom.Width; i++)
        //            graphics.Graphics.DrawLine(bottomPen, rectangle.X, rectangle.Bottom - i, rectangle.Right - 1, rectangle.Bottom - i);
        //    }

        //    if (border.Right.Width > 0)
        //    {
        //        Pen rightPen = pens.GetPen(border.Right.Color, 1, border.Right.DashStyle);
        //        for (int i = 1; i <= border.Right.Width; i++)
        //            graphics.Graphics.DrawLine(rightPen, rectangle.Right - i, rectangle.Y, rectangle.Right - i, rectangle.Bottom - 1);
        //    }

        //    if (border.Top.Width > 0)
        //    {
        //        Pen topPen = pens.GetPen(border.Top.Color, 1, border.Top.DashStyle);
        //        for (int i = 0; i < border.Top.Width; i++)
        //            graphics.Graphics.DrawLine(topPen, rectangle.X, rectangle.Y + i, rectangle.Right - 1, rectangle.Y + i);
        //    }
        //}

        public void Draw(GraphicsCache graphics, RectangleF rectangle)
        {
            RectangleBorder border = this;

            //Calculate the padding
            rectangle = new RectangleF(rectangle.X + Left.Padding, rectangle.Y + Top.Padding, rectangle.Width - (Left.Padding + Right.Padding), rectangle.Height - (Top.Padding + Bottom.Padding));

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

            PensCache pens = graphics.PensCache;

            if (border.Left.Width > 0)
            {
                Pen   leftPen = pens.GetPen(border.Left.Color, border.Left.Width, border.Left.DashStyle);
                float x;
                float bottom;
                if (border.Left.Width > 1)
                {
                    x      = rectangle.X + ((float)border.Left.Width) / 2;
                    bottom = rectangle.Bottom;
                }
                else
                {
                    x      = rectangle.X;
                    bottom = rectangle.Bottom - 1;
                }
                graphics.Graphics.DrawLine(leftPen, new PointF(x, rectangle.Y),
                                           new PointF(x, bottom));
            }

            if (border.Right.Width > 0)
            {
                Pen   rightPen = pens.GetPen(border.Right.Color, border.Right.Width, border.Right.DashStyle);
                float x;
                float bottom;
                if (border.Right.Width > 1)
                {
                    x      = rectangle.Right - border.Right.Width / 2;
                    bottom = rectangle.Bottom;
                }
                else
                {
                    x      = rectangle.Right - 1;
                    bottom = rectangle.Bottom - 1;
                }
                graphics.Graphics.DrawLine(rightPen, new PointF(x, rectangle.Y),
                                           new PointF(x, bottom));
            }

            if (border.Top.Width > 0)
            {
                Pen   topPen = pens.GetPen(border.Top.Color, border.Top.Width, border.Top.DashStyle);
                float y;
                float right;
                if (border.Top.Width > 1)
                {
                    y     = rectangle.Y + border.Top.Width / 2;
                    right = rectangle.Right;
                }
                else
                {
                    y     = rectangle.Y;
                    right = rectangle.Right - 1;
                }
                graphics.Graphics.DrawLine(topPen, new PointF(rectangle.X, y),
                                           new PointF(right, y));
            }

            if (border.Bottom.Width > 0)
            {
                Pen   bottomPen = pens.GetPen(border.Bottom.Color, border.Bottom.Width, border.Bottom.DashStyle);
                float y;
                float right;
                if (border.Bottom.Width > 1)
                {
                    y     = rectangle.Bottom - border.Bottom.Width / 2;
                    right = rectangle.Right;
                }
                else
                {
                    y     = rectangle.Bottom - 1;
                    right = rectangle.Right - 1;
                }
                graphics.Graphics.DrawLine(bottomPen, new PointF(rectangle.X, y),
                                           new PointF(right, y));
            }
        }
Ejemplo n.º 7
0
 public MeasureHelper(GraphicsCache graphics)
 {
     mGraphics = graphics.Graphics;
     mDisposeObj = false;
 }