示例#1
0
        /// <summary>
        /// Performs drawing of the item and its children.
        /// </summary>
        /// <param name="renderInfo">Holds contextual rendering information.</param>
        protected override void RenderOverride(GridRenderInfo renderInfo)
        {
            GridPanel panel = Parent as GridPanel;

            if (panel != null)
            {
                Graphics g = renderInfo.Graphics;
                Rectangle bounds = Bounds;

                ColumnHeaderRowVisualStyle style = GetEffectiveRowHeaderStyle();
                GridPanelVisualStyle pstyle = panel.GetEffectiveStyle();

                if (SuperGrid.DoPreRenderColumnHeaderEvent(g,
                    this, null, RenderParts.Background, bounds) == false)
                {
                    RenderRowBackground(g, style, bounds);

                    SuperGrid.DoPostRenderColumnHeaderEvent(g,
                        this, null, RenderParts.Background, bounds);
                }

                RenderColumnBorder(g, panel, bounds);

                if (panel.IsSubPanel == true ||
                    panel.FrozenColumnCount <= 0)
                {
                    RenderAllColumns(renderInfo, panel, pstyle, bounds);
                }
                else
                {
                    RenderScrollableColumns(renderInfo, panel);
                    RenderFrozenColumns(renderInfo, panel, pstyle, bounds);
                }

                RenderRowHeader(g, panel, style, pstyle);
            }
        }
示例#2
0
        /// <summary>
        /// Performs drawing of the item and its children
        /// </summary>
        /// <param name="renderInfo">Holds contextual rendering information.</param>
        protected override void RenderOverride(GridRenderInfo renderInfo)
        {
            GridPanel panel = GridPanel;

            if (panel != null)
            {
                Rectangle bounds = Bounds;

                GridPanelVisualStyle pstyle = panel.GetEffectiveStyle();

                if (bounds.IntersectsWith(renderInfo.ClipRectangle))
                    RenderRow(renderInfo, panel, pstyle, bounds);

                if (Rows != null && Expanded == true)
                    RenderSubItems(renderInfo, panel, pstyle, panel.IsSubPanel, IsVFrozen);

                RenderDesignerElement(renderInfo, bounds);
            }
        }
示例#3
0
 /// <summary>
 /// Performs drawing of the item and its children.
 /// </summary>
 /// <param name="renderInfo">Holds contextual rendering information.</param>
 protected abstract void RenderOverride(GridRenderInfo renderInfo);
示例#4
0
 /// <summary>
 /// Performs drawing of the item and its children.
 /// </summary>
 /// <param name="renderInfo">Holds contextual rendering information.</param>
 protected override void RenderOverride(GridRenderInfo renderInfo)
 {
     RenderDesignerElement(renderInfo, Bounds);
 }
示例#5
0
        /// <summary>
        /// Performs drawing of the item and its children.
        /// </summary>
        /// <param name="renderInfo">Holds contextual rendering information.</param>
        protected override void RenderOverride(GridRenderInfo renderInfo)
        {
            GridPanel panel = GridPanel;

            if (panel != null)
            {
                Rectangle bounds = Bounds;

                if (bounds.Height > 0)
                {
                    Rectangle r = bounds;
                    r.Inflate(2, 2);

                    if (r.IntersectsWith(renderInfo.ClipRectangle))
                        RenderRow(renderInfo, panel, bounds);
                }
            }
        }
示例#6
0
        private void PaintControl(GridRenderInfo renderInfo)
        {
            Rectangle r = ClientRectangle;
            r.Intersect(renderInfo.ClipRectangle);

            if (r.Width > 0 && r.Height > 0)
                _PrimaryGrid.Render(renderInfo);

            RenderScrollBoxArea(renderInfo);
        }
示例#7
0
        private void RenderWaterMark(GridRenderInfo renderInfo)
        {
            Rectangle r = ViewRect;
            r.X = r.Right - 30;
            r.Width = 30;

            if (r.IntersectsWith(renderInfo.ClipRectangle) == true)
            {
                Graphics g = renderInfo.Graphics;

                using (StringFormat sf = new StringFormat())
                {
                    sf.Alignment = StringAlignment.Center;
                    sf.LineAlignment = StringAlignment.Center;

                    sf.FormatFlags = StringFormatFlags.NoWrap | StringFormatFlags.DirectionVertical;

                    using (Font font = new Font("Times New Roman", 9))
                    {
                        Rectangle t = r;
                        t.X++;
                        t.Y++;

                        using (SolidBrush brush = new SolidBrush(Color.FromArgb(128, Color.Gray)))
                        {
                            g.DrawString("DevComponents SuperGrid Trial",
                                         font, brush, t, sf);
                        }

                        using (SolidBrush brush = new SolidBrush(Color.FromArgb(128, Color.Gainsboro)))
                        {
                            g.DrawString("DevComponents SuperGrid Trial",
                                         font, brush, r, sf);
                        }
                    }
                }
            }
        }
示例#8
0
        private void RenderEmptyCell(GridRenderInfo renderInfo,
            GridColumn column, bool isHFrozen, bool isVFrozen)
        {
            if (column.Visible == true)
            {
                Rectangle r = column.BoundsRelative;
                r.Y = BoundsRelative.Y;
                r.Height = FixedRowHeight;

                Rectangle bounds = r;

                if (isHFrozen == false)
                    bounds.X -= HScrollOffset;

                if (isVFrozen == false)
                {
                    bounds.Y -= VScrollOffset;
                    bounds.Intersect(SViewRect);
                }

                if (bounds.IntersectsWith(renderInfo.ClipRectangle))
                {
                    GridCell cell = GetEmptyRenderCell(column);

                    cell.IsMouseOver =
                        bounds.Contains(SuperGrid.PointToClient(Control.MousePosition));

                    cell.Render(renderInfo);
                }
            }
        }
示例#9
0
        protected void RenderRowHeader(GridRenderInfo renderInfo,
            GridPanel panel, GridContainer item, GridPanelVisualStyle pstyle, Rectangle r)
        {
            Graphics g = renderInfo.Graphics;

            r.Width = panel.RowHeaderWidth;

            if (r.IntersectsWith(renderInfo.ClipRectangle))
            {
                if (r.Height > 100)
                    r = GetCenterBounds(r);

                RenderRowHeader(g, panel, item, pstyle, r, true);
            }
        }
示例#10
0
        private void RenderFrozenColumns(
            GridRenderInfo renderInfo, GridPanel panel)
        {
            GridCellCollection cells = _Cells;
            GridColumnCollection columns = panel.Columns;

            bool isVFrozen = IsVFrozen;

            int[] map = columns.DisplayIndexMap;
            int n = Math.Min(map.Length, panel.FrozenColumnCount);

            for (int i = 0; i < n; i++)
            {
                int index = map[i];

                if (index < cells.Count)
                {
                    RenderCell(renderInfo,
                        columns[index], cells[index], true, isVFrozen);
                }
                else
                {
                    RenderEmptyCell(renderInfo,
                        columns[index], true, isVFrozen);
                }
            }
        }
示例#11
0
        private bool RenderCell(GridRenderInfo renderInfo,
            GridColumn column, GridCell cell, bool isHFrozen, bool isVFrozen)
        {
            if (column.Visible == true)
            {
                Rectangle bounds = cell.BoundsRelative;

                if (isHFrozen == false)
                    bounds.X -= HScrollOffset;

                if (isVFrozen == false)
                    bounds.Y -= VScrollOffset;

                if (bounds.X > renderInfo.ClipRectangle.Right)
                    return (false);

                cell.Render(renderInfo);
            }

            return (true);
        }
示例#12
0
        private void RenderScrollableColumns(
            GridRenderInfo renderInfo, GridPanel panel)
        {
            GridCellCollection cells = _Cells;
            GridColumnCollection columns = panel.Columns;

            bool isVFrozen = IsVFrozen;

            int[] map = columns.DisplayIndexMap;
            for (int i = panel.FrozenColumnCount; i < map.Length; i++)
            {
                int index = map[i];

                if (index < cells.Count)
                {
                    RenderCell(renderInfo,
                        columns[index], cells[index], false, isVFrozen);
                }
                else
                {
                    RenderEmptyCell(renderInfo,
                        columns[index], false, isVFrozen);
                }
            }
        }
示例#13
0
        private void RenderAllColumns(
            GridRenderInfo renderInfo, GridPanel panel)
        {
            GridCellCollection cells = _Cells;
            GridColumnCollection columns = panel.Columns;

            bool isVFrozen = IsVFrozen;

            int[] map = columns.DisplayIndexMap;
            for (int i = 0; i < map.Length; i++)
            {
                int index = map[i];

                GridColumn column = columns[index];

                if (column.Bounds.IntersectsWith(renderInfo.ClipRectangle))
                {
                    if (index < cells.Count)
                    {
                        if (RenderCell(renderInfo, column, cells[index], false, isVFrozen) == false)
                            break;
                    }
                    else
                    {
                        RenderEmptyCell(renderInfo, column, false, isVFrozen);
                    }
                }
            }
        }
示例#14
0
        private void RenderRow(GridRenderInfo renderInfo,
            GridPanel panel, GridPanelVisualStyle pstyle, Rectangle r)
        {
            Graphics g = renderInfo.Graphics;
            RenderParts parts = RenderParts.Background;

            SuperGrid.DoPreRenderRowEvent(g, this, parts, r);
            
            if (HScrollOffset == 0 ||
                panel.Parent != null || panel.FrozenColumnCount <= 0)
            {
                RenderAllColumns(renderInfo, panel);
            }
            else
            {
                RenderScrollableColumns(renderInfo, panel);
                RenderFrozenColumns(renderInfo, panel);
            }

            SuperGrid.DoPostRenderRowEvent(g, this, parts, r);

            parts = RenderParts.Border;

            if (panel.ShowRowHeaders == true)
                parts |= RenderParts.RowHeader;

            Rectangle w = WhiteSpaceBounds;

            if (w.Width > 0 && w.Height > 0)
                parts |= RenderParts.Whitespace;

            if (SuperGrid.DoPreRenderRowEvent(g, this, parts, r) == false)
            {
                if (panel.ShowRowHeaders == true)
                    RenderRowHeader(renderInfo, panel, this, pstyle, r);

                if (w.Width > 0 && w.Height > 0)
                    RenderRowWhitespace(renderInfo, panel, pstyle, w);

                SuperGrid.DoPostRenderRowEvent(g, this, parts, r);
            }

            if (panel.FocusCuesEnabled == true &&
                SuperGrid.ActiveElement == this)
            {
                RenderFocusRect(g, r);
            }
        }
示例#15
0
        private void RenderScrollableColumns(
            GridRenderInfo renderInfo, GridPanel panel)
        {
            Graphics g = renderInfo.Graphics;
            GridColumnCollection columns = _Columns;

            int[] map = columns.DisplayIndexMap;
            for (int i = 0; i < map.Length; i++)
            {
                int index = map[i];

                GridColumn column = columns[index];

                if (column.Visible == true && column.IsHFrozen == false)
                {
                    Rectangle r = GetBounds(panel, column);

                    if (r.IntersectsWith(renderInfo.ClipRectangle) == true)
                        RenderColumnHeader(g, panel, column, r, true);
                }
            }
        }
示例#16
0
        private void RenderRowWhitespace(GridRenderInfo renderInfo,
            GridPanel panel, GridPanelVisualStyle pstyle, Rectangle r)
        {
            Graphics g = renderInfo.Graphics;

            StyleState state = GetWhiteSpaceState(panel);
            RowVisualStyle style = GetEffectiveRowStyle(this, state);

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

            if (panel.ShowWhitespaceRowLines == true)
            {
                switch (panel.GridLines)
                {
                    case GridLines.Both:
                    case GridLines.Horizontal:
                        if (pstyle.HorizontalLinePattern != LinePattern.None &&
                            pstyle.HorizontalLinePattern != LinePattern.NotSet)
                        {
                            using (Pen pen = new Pen(pstyle.HorizontalLineColor))
                            {
                                pen.DashStyle = (DashStyle) pstyle.HorizontalLinePattern;

                                g.DrawLine(pen, r.Left, r.Bottom - 1, r.Right - 1, r.Bottom - 1);
                                g.DrawLine(pen, r.Left, r.Top - 1, r.Right - 1, r.Top - 1);
                            }
                        }
                        break;
                }
            }
        }
示例#17
0
        private void RenderFrozenColumns(GridRenderInfo renderInfo,
            GridPanel panel, GridPanelVisualStyle pstyle, Rectangle bounds)
        {
            Graphics g = renderInfo.Graphics;
            GridColumnCollection columns = _Columns;

            GridColumn lastCol = null;

            int[] map = columns.DisplayIndexMap;
            for (int i = 0; i < map.Length; i++)
            {
                int index = map[i];

                GridColumn column = columns[index];

                if (column.Visible == true && column.IsHFrozen == true)
                {
                    Rectangle r = GetBounds(panel, column);

                    if (r.IntersectsWith(renderInfo.ClipRectangle) == true)
                        RenderColumnHeader(g, panel, column, r, true);

                    lastCol = column;
                }
            }

            RenderFrozenColumnMarker(g, panel, pstyle, lastCol, bounds);
        }
示例#18
0
        protected void RenderSubItems(GridRenderInfo renderInfo,
            GridPanel panel, GridPanelVisualStyle pstyle, bool isSubPanel, bool isFrozen)
        {
            Rectangle t = SViewRect;

            GridItemsCollection items = Rows;
            for (int i = FirstOnScreenRowIndex; i < items.Count; i++)
            {
                GridElement item = items[i];

                if (item.Visible == true)
                {
                    GridPanel ipanel = item as GridPanel;

                    if (ipanel != null)
                    {
                        Graphics g = renderInfo.Graphics;
                        Rectangle r = ipanel.ContainerBounds;

                        if (isFrozen == false)
                            r.Y -= VScrollOffset;

                        if (isSubPanel == true)
                            r.X -= HScrollOffset;

                        if (r.Y > t.Bottom)
                            break;

                        if (r.IntersectsWith(renderInfo.ClipRectangle))
                        {
                            Rectangle r2 = r;

                            if (panel.ShowRowHeaders == true)
                            {
                                r2.X += panel.RowHeaderWidth;
                                r2.Width -= panel.RowHeaderWidth;
                            }

                            if (SuperGrid.DoPreRenderPanelRowEvent(g,
                                ipanel, RenderParts.Background | RenderParts.Border, r2) == false)
                            {
                                RenderRowBackground(g, ipanel, r2);
                                RenderRowBorder(g, panel, r2);

                                SuperGrid.DoPostRenderPanelRowEvent(g,
                                    ipanel, RenderParts.Background | RenderParts.Border, r2);
                            }

                            RenderTreeLines(g, panel, ipanel, r, isSubPanel);
                            RenderRowCheckBox(g, panel, ipanel);

                            item.Render(renderInfo);

                            if (panel.ShowRowHeaders == true)
                            {
                                r2 = r;
                                r2.Width = panel.RowHeaderWidth;

                                if (SuperGrid.DoPreRenderPanelRowEvent(g,
                                    ipanel, RenderParts.RowHeader, r2) == false)
                                {
                                    RenderRowHeader(renderInfo, panel, ipanel, pstyle, r2);

                                    SuperGrid.DoPostRenderPanelRowEvent(g,
                                        ipanel, RenderParts.RowHeader, r2);
                                }
                            }
                        }
                    }
                    else
                    {
                        Rectangle r = item.BoundsRelative;

                        if (isFrozen == false)
                            r.Y -= VScrollOffset;

                        if (isSubPanel == true)
                            r.X -= HScrollOffset;

                        if (r.Y > t.Bottom)
                            break;

                        if (r.IntersectsWith(renderInfo.ClipRectangle))
                            item.Render(renderInfo);
                    }
                }
            }
        }
示例#19
0
        private void RenderScrollBoxArea(GridRenderInfo renderInfo)
        {
            if (_HScrollBar.Visible && _VScrollBar.Visible)
            {
                Rectangle r = _HScrollBar.Bounds;
                r.X = _VScrollBar.Bounds.X;
                r.Width = _VScrollBar.Bounds.Width;

                if (r.IntersectsWith(renderInfo.ClipRectangle))
                    renderInfo.Graphics.FillRectangle(SystemBrushes.Control, r);
            }
        }
示例#20
0
        private void RenderDesignerElement(
            GridRenderInfo renderInfo, Rectangle r)
        {
            if (SuperGrid.DesignerElement == this)
            {
                r.X -= 2;
                r.Y++;
                r.Height -= 4;
                r.Width += 5;

                if (r.Width > 0 && r.Height > 0)
                {
                    using (Pen pen = new Pen(Color.Purple))
                    {
                        pen.DashStyle = DashStyle.Dash;

                        renderInfo.Graphics.DrawRectangle(pen, r);

                    }
                }
            }
        }
示例#21
0
        private GridRenderInfo GetGridRenderInfo(PaintEventArgs e)
        {
            GridRenderInfo renderInfo =
                new GridRenderInfo(e.Graphics, Rectangle.Ceiling(e.ClipRectangle));

            renderInfo.RightToLeft = (RightToLeft == RightToLeft.Yes);

            return (renderInfo);
        }
示例#22
0
        protected override void RenderOverride(GridRenderInfo renderInfo)
        {
            GridPanel panel = GridPanel;

            if (panel != null)
            {
                Rectangle r = Bounds;

                if (r.IntersectsWith(renderInfo.ClipRectangle))
                {
                    Graphics g = renderInfo.Graphics;
                    GroupHeaderVisualStyle style = GetEffectiveStyle();

                    if (SuperGrid.DoPreRenderGroupHeaderEvent(g,
                        this, RenderParts.Background | RenderParts.RowHeader, r) == false)
                    {
                        RenderGroupBackground(g, style, r);
                        RenderRowHeader(g, panel, style, r);

                        SuperGrid.DoPostRenderGroupHeaderEvent(g,
                            this, RenderParts.Background | RenderParts.RowHeader, r);
                    }

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

                    r = GetAdjustedBounds(style, r);

                    if (r.Height < panel.GroupHeaderHeight)
                        r.Height = panel.GroupHeaderHeight;

                    if (SuperGrid.DoPreRenderGroupHeaderEvent(g,
                        this, RenderParts.Content, r) == false)
                    {
                        RenderHeaderText(g, style, r);
                        RenderHeaderUnderline(g, panel, style, r);

                        SuperGrid.DoPostRenderGroupHeaderEvent(g,
                            this, RenderParts.Content, r);
                    }
                }

                if (Rows != null && Expanded == true)
                {
                    foreach (GridElement item in Rows)
                    {
                        if (item.Visible == true)
                            item.Render(renderInfo);
                    }
                }
            }
        }
示例#23
0
        private void RenderDesignerElement(
            GridRenderInfo renderInfo, Rectangle r)
        {
            if (SuperGrid.DesignerElement == this)
            {
                int n = r.Y - (GridPanel.ColumnHeader.Bounds.Y + 4);

                r.X += 2;
                r.Y = GridPanel.ColumnHeader.Bounds.Y - 4;
                r.Width -= 6;
                r.Height += n + 4;

                if (r.Width > 0 && r.Height > 0)
                {
                    using (Pen pen = new Pen(Color.Purple))
                    {
                        pen.DashStyle = DashStyle.Dash;

                        renderInfo.Graphics.DrawRectangle(pen, r);
                    }
                }
            }
        }
示例#24
0
 /// <summary>
 /// This method is used by the items internally to invoke the rendering
 /// for the item. Override RenderOverride method to perform actual rendering.
 /// </summary>
 /// <param name="renderInfo">Holds contextual rendering information.</param>
 internal void Render(GridRenderInfo renderInfo)
 {
     RenderOverride(renderInfo);
 }
示例#25
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);
            }
        }
示例#26
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);
        }