示例#1
0
        private void RenderColumnBorder(
            Graphics g, GridPanel panel, Rectangle bounds)
        {
            Rectangle r = bounds;
            GridPanelVisualStyle pstyle = panel.GetEffectiveStyle();

            if (pstyle.HeaderHLinePattern != LinePattern.None &&
                pstyle.HeaderHLinePattern != LinePattern.NotSet)
            {
                using (Pen pen = new Pen(pstyle.HeaderLineColor))
                {
                    pen.DashStyle = (DashStyle)pstyle.HeaderHLinePattern;

                    g.DrawLine(pen, r.X, r.Bottom - 1, r.Right - 2, r.Bottom - 1);
                    g.DrawLine(pen, r.X, r.Top - 1, r.Right - 2, r.Top - 1);
                }
            }
            
            if (pstyle.HeaderVLinePattern != LinePattern.None &&
                pstyle.HeaderVLinePattern != LinePattern.NotSet)
            {
                using (Pen pen = new Pen(pstyle.HeaderLineColor))
                {
                    pen.DashStyle = (DashStyle)pstyle.HeaderVLinePattern;

                    g.DrawLine(pen, r.Right - 1, r.Top - 1, r.Right - 1, r.Bottom - 1);
                }
            }
        }
示例#2
0
        protected virtual void RenderRow(
            GridRenderInfo renderInfo, GridPanel panel, Rectangle r)
        {
            Graphics g = renderInfo.Graphics;

            TextRowVisualStyle style = GetEffectiveStyle();
            GridPanelVisualStyle pstyle = panel.GetEffectiveStyle();

            Image image = style.GetImage(panel);

            Rectangle tb, ib;
            r = GetItemBounds(panel, image, style, r, out tb, out ib);

            if (SuperGrid.DoPreRenderTextRowEvent(g, this, RenderParts.Background, r) == false)
            {
                RenderRowBackground(g, style, r);
                SuperGrid.DoPostRenderTextRowEvent(g, this, RenderParts.Background, r);
            }

            RenderBorder(g, panel, pstyle, r);

            if (SuperGrid.DoPreRenderTextRowEvent(g, this, RenderParts.Border, r) == false)
            {
                RenderRowBorder(g, style, r);
                SuperGrid.DoPostRenderTextRowEvent(g, this, RenderParts.Border, r);
            }

            if (style.ImageOverlay != ImageOverlay.Top)
                RenderRowImage(g, panel, style, ib);

            if (SuperGrid.DoPreRenderTextRowEvent(g, this, RenderParts.Content, r) == false)
            {
                RenderRowText(g, style, tb);
                SuperGrid.DoPostRenderTextRowEvent(g, this, RenderParts.Content, tb);
            }

            if (style.ImageOverlay == ImageOverlay.Top)
                RenderRowImage(g, panel, style, ib);

            if (SuperGrid.DoPreRenderTextRowEvent(g, this, RenderParts.RowHeader, r) == false)
            {
                RenderRowHeader(g, panel, pstyle, r);
                SuperGrid.DoPostRenderTextRowEvent(g, this, RenderParts.RowHeader, r);
            }
        }
示例#3
0
        private void RenderColumnBorder(
            Graphics g, GridPanel panel, Rectangle bounds)
        {
            Rectangle r = bounds;
            Rectangle p = panel.PanelBounds;

            GridPanelVisualStyle pstyle = panel.GetEffectiveStyle();

            if (r.Y > 0 && r.Y <= p.Y)
            {
                r.Height -= (p.Y - r.Y + 1);
                r.Y = p.Y + 1;
            }

            using (Pen pen = new Pen(pstyle.HeaderLineColor))
                g.DrawRectangle(pen, r.X - 1, r.Top - 1, r.Width, r.Height);
        }
示例#4
0
        private void RenderRowHeader(Graphics g,
            GridPanel panel, GroupHeaderVisualStyle style, Rectangle r)
        {
            if (CanShowRowHeader(panel) == true)
            {
                r.Width = panel.RowHeaderWidth;

                using (Brush br = style.RowHeaderStyle.Background.GetBrush(r))
                    g.FillRectangle(br, r);

                using (Pen pen = new Pen(style.RowHeaderStyle.BorderHighlightColor))
                {
                    g.DrawLine(pen, r.X + 1, r.Top, r.Right - 2, r.Top);
                    g.DrawLine(pen, r.X + 1, r.Top, r.X + 1, r.Bottom - 1);
                }

                GridPanelVisualStyle pstyle = panel.GetEffectiveStyle();

                using (Pen pen = new Pen(pstyle.HeaderLineColor))
                {
                    g.DrawLine(pen, r.X, r.Top - 1, r.Right - 1, r.Top - 1);
                    g.DrawLine(pen, r.X, r.Bottom - 1, r.Right - 2, r.Bottom - 1);
                    g.DrawLine(pen, r.Right - 1, r.Top, r.Right - 1, r.Bottom - 1);
                }

                r.X += 4;
                r.Width -= 4;

                int n = RenderIndicatorImage(g, panel, this, r);

                r.X += n;
                r.Width -= n;

                if (panel.ShowRowGridIndex == true)
                    RenderGridIndex(g, this, style.RowHeaderStyle, r);
            }
        }
示例#5
0
        protected void RenderRowBorder(
            Graphics g, GridPanel panel, Rectangle r)
        {
            if (panel.GridLines == GridLines.Horizontal || panel.GridLines == GridLines.Both)
            {
                if (panel.ShowWhitespaceRowLines == true)
                {
                    GridPanelVisualStyle pstyle = panel.GetEffectiveStyle();

                    using (Pen pen = new Pen(pstyle.HorizontalLineColor))
                    {
                        pen.DashStyle = (DashStyle)pstyle.HorizontalLinePattern;
                        pen.DashOffset = r.X % 2;

                        g.DrawLine(pen, r.X, r.Top - 1, r.Right - 1, r.Top - 1);
                        g.DrawLine(pen, r.X, r.Bottom - 1, r.Right - 1, r.Bottom - 1);
                    }
                }
            }
        }
示例#6
0
        protected override void RenderRow(
            GridRenderInfo renderInfo, GridPanel panel, Rectangle r)
        {
            base.RenderRow(renderInfo, panel, r);

            Graphics g = renderInfo.Graphics;

            if (CanShowRowHeader(panel) == true)
            {
                r.X += panel.RowHeaderWidth;
                r.Width -= panel.RowHeaderWidth;
            }

            Region oldClip = g.Clip;

            try
            {
                g.SetClip(r, CombineMode.Intersect);

                if (_GroupBoxes.Count > 1)
                {
                    GridPanelVisualStyle pstyle = panel.GetEffectiveStyle();
                    GridGroupBox lastBox = null;

                    foreach (GridGroupBox box in _GroupBoxes)
                    {
                        if (box.Column != null)
                        {
                            RenderGroupBox(panel, box, lastBox, g, pstyle);
                            lastBox = box;
                        }
                    }
                }
                else
                {
                    RenderWaterMarkText(panel, g);
                }
            }
            finally
            {
                g.Clip = oldClip;
            }

            if (_InsertRect.IsEmpty == false)
                g.DrawImageUnscaled(InsertMarker, _InsertRect);
        }
示例#7
0
        ///<summary>
        /// RenderTreeLines
        ///</summary>
        ///<param name="g"></param>
        ///<param name="panel"></param>
        ///<param name="bounds"></param>
        ///<param name="item"></param>
        ///<param name="indentLevel"></param>
        ///<param name="indentAmount"></param>
        ///<param name="width"></param>
        ///<param name="hasButton"></param>
        static public void RenderLines(Graphics g, GridPanel panel, Rectangle bounds,
            GridContainer item, int indentLevel, int indentAmount, int width, bool hasButton)
        {
            Rectangle r = bounds;

            GridPanelVisualStyle style = panel.GetEffectiveStyle();

            if (style.TreeLinePattern == LinePattern.Dot)
            {
                if (r.Y % 2 == 0)
                {
                    r.Y++;

                    if (r.Height % 2 != 0)
                        r.Height--;
                }
            }

            GetLineBounds(bounds, ref r, indentLevel, indentAmount, width);

            using (Pen pen = new Pen(style.TreeLineColor))
            {
                pen.DashStyle = (DashStyle)style.TreeLinePattern;

                Rectangle t = Rectangle.Empty;
                int n = 0;

                if (item is GridPanel)
                {
                    t = item.BoundsRelative;

                    t.X -= item.HScrollOffset;
                    t.Y -= item.VScrollOffset;

                    if (item.HasCheckBox == true)
                        n = panel.CheckBoxSize.Width;
                }

                if (r.Width > 0)
                    DrawDash(g, item, style, pen, r, t, n, hasButton);

                int rowIndex = item.GridIndex;

                GridContainer tRow = item;
                GridContainer nRow = tRow.GetNextItem();

                while (tRow != null)
                {
                    int tIndex = (nRow != null) ? nRow.GridIndex : -1;

                    if (r.Width > 0)
                    {
                        if (t.IsEmpty || r.Right <= t.Left)
                        {
                            if (tIndex > rowIndex)
                            {
                                if (rowIndex == 0 && item.Parent is GridPanel)
                                    DrawLower(g, style, pen, r);
                                else
                                    DrawFull(g, pen, r);
                            }
                            else
                            {
                                if (item == tRow && (indentLevel > 0 || rowIndex > 0))
                                    DrawUpper(g, pen, r);
                            }
                        }
                    }

                    tRow = tRow.Parent as GridRow;

                    if (tRow != null)
                        nRow = tRow.GetNextItem();

                    GetLineBounds(bounds, ref r, --indentLevel, indentAmount, width);
                }
            }
        }