示例#1
0
 protected override void RenderBorder(Graphics g,
     GridPanel panel, GridPanelVisualStyle pstyle, Rectangle r)
 {
     using (Pen pen = new Pen(pstyle.HeaderLineColor))
     {
         r.Height--;
         g.DrawLine(pen, r.X, r.Bottom, r.Right - 1, r.Bottom);
     }
 }
        private void InitGridPanelStyle(DefaultVisualStyles visualStyle, ColorFactory factory)
        {
            GridPanelVisualStyle style = new GridPanelVisualStyle();

            style.Background = new Background(factory.GetColor(0xFFFFFF));
            style.BorderColor = new BorderColor(factory.GetColor(0x313131));
            style.BorderPattern.All = LinePattern.Solid;
            style.BorderThickness = new Thickness(1);
            style.TextColor = factory.GetColor(0x000000);

            style.TreeLineColor = factory.GetColor(0x484848);
            style.HeaderLineColor = factory.GetColor(0x444444);
            style.HorizontalLineColor = factory.GetColor(0xDADCDD);
            style.VerticalLineColor = factory.GetColor(0xDADCDD);

            style.TreeLinePattern = LinePattern.Solid;
            style.HorizontalLinePattern = LinePattern.Solid;
            style.VerticalLinePattern = LinePattern.Solid;
            style.HeaderHLinePattern = LinePattern.Solid;
            style.HeaderVLinePattern = LinePattern.Solid;

            BaseTreeButtonVisualStyle tstyle = new BaseTreeButtonVisualStyle();

            tstyle.BorderColor = factory.GetColor(Color.SlateGray);
            tstyle.HotBorderColor = factory.GetColor(Color.SlateGray);
            tstyle.LineColor = factory.GetColor(Color.DarkSlateGray);
            tstyle.HotLineColor = factory.GetColor(Color.DarkSlateGray);
            tstyle.Background = new Background(factory.GetColor(Color.White), factory.GetColor(Color.Gainsboro), 90);
            tstyle.HotBackground = new Background(factory.GetColor(Color.White), factory.GetColor(Color.Gainsboro), 90);

            style.CircleTreeButtonStyle.CollapseButton = tstyle;
            style.CircleTreeButtonStyle.ExpandButton = tstyle;

            style.SquareTreeButtonStyle.CollapseButton = tstyle;
            style.SquareTreeButtonStyle.ExpandButton = tstyle;

            tstyle = new BaseTreeButtonVisualStyle();

            tstyle.BorderColor = factory.GetColor(Color.Black);
            tstyle.HotBorderColor = factory.GetColor(0x27C7F7);
            tstyle.Background = new Background(factory.GetColor(Color.Black));
            tstyle.HotBackground = new Background(factory.GetColor(0xC7EBFA));

            style.TriangleTreeButtonStyle.CollapseButton = tstyle;

            tstyle = new BaseTreeButtonVisualStyle();

            tstyle.BorderColor = factory.GetColor(Color.DimGray);
            tstyle.HotBorderColor = factory.GetColor(0x27C7F7);
            tstyle.Background = new Background(factory.GetColor(Color.White));
            tstyle.HotBackground = new Background(factory.GetColor(0xC7EBFA));

            style.TriangleTreeButtonStyle.ExpandButton = tstyle;

            visualStyle.GridPanelStyle = style;
        }
示例#3
0
        private void InitGridPanelStyle(DefaultVisualStyles visualStyle, ColorFactory factory)
        {
            GridPanelVisualStyle style = new GridPanelVisualStyle();

            MetroPartColors metroColors = _MetroPartColors;
            style.Background = new Background(factory.GetColor(metroColors.CanvasColor));
            style.BorderColor = new BorderColor(factory.GetColor(metroColors.CanvasColorDarkShade));
            style.BorderPattern.All = LinePattern.Solid;
            style.BorderThickness = new Thickness(1);
            style.TextColor = factory.GetColor(metroColors.TextColor);

            style.TreeLineColor = factory.GetColor(metroColors.CanvasColorLighterShade);
            style.HeaderLineColor = factory.GetColor(metroColors.CanvasColorDarkShade);
            style.HorizontalLineColor = factory.GetColor(metroColors.CanvasColorLighterShade);
            style.VerticalLineColor = factory.GetColor(metroColors.CanvasColorLighterShade);

            style.TreeLinePattern = LinePattern.Solid;
            style.HorizontalLinePattern = LinePattern.Solid;
            style.VerticalLinePattern = LinePattern.Solid;
            style.HeaderHLinePattern = LinePattern.Solid;
            style.HeaderVLinePattern = LinePattern.Solid;

            BaseTreeButtonVisualStyle tstyle = new BaseTreeButtonVisualStyle();

            tstyle.BorderColor = factory.GetColor(metroColors.CanvasColorLighterShade);
            tstyle.HotBorderColor = factory.GetColor(metroColors.CanvasColorLighterShade);
            tstyle.LineColor = factory.GetColor(metroColors.CanvasColorDarkShade);
            tstyle.HotLineColor = factory.GetColor(metroColors.CanvasColorDarkShade);
            tstyle.Background = new Background(factory.GetColor(metroColors.CanvasColor), factory.GetColor(metroColors.CanvasColorDarkShade), 90);
            tstyle.HotBackground = new Background(factory.GetColor(metroColors.CanvasColor), factory.GetColor(metroColors.CanvasColorDarkShade), 90);

            style.CircleTreeButtonStyle.CollapseButton = tstyle;
            style.CircleTreeButtonStyle.ExpandButton = tstyle;

            style.SquareTreeButtonStyle.CollapseButton = tstyle;
            style.SquareTreeButtonStyle.ExpandButton = tstyle;

            style.TriangleTreeButtonStyle.CollapseButton = tstyle;
            style.TriangleTreeButtonStyle.ExpandButton = tstyle;

            style.TriangleTreeButtonStyle.ExpandButton = tstyle;
            visualStyle.GridPanelStyle = style;
        }
示例#4
0
        private void RenderFrozenColumnMarker(Graphics g,
            GridPanel panel, GridPanelVisualStyle pstyle, GridColumn lastCol, Rectangle bounds)
        {
            if (lastCol != null)
            {
                Rectangle r = lastCol.BoundsRelative;

                r.Y = bounds.Y + 3;
                r.Height = bounds.Height - 5;

                if (panel.IsSubPanel == true)
                    r.X -= HScrollOffset;

                if (r.Height > 0 && r.Width > 0)
                {
                    using (Pen pen = new Pen(pstyle.HeaderLineColor))
                    {
                        g.DrawLine(pen, r.Right - 3,
                                   r.Top - 1, r.Right - 3, r.Bottom - 1);
                    }
                }
            }
        }
示例#5
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);
            }
        }
示例#6
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);
        }
示例#7
0
        private void RenderRowHeader(Graphics g,
            GridPanel panel, ColumnHeaderRowVisualStyle style, GridPanelVisualStyle pstyle)
        {
            Rectangle r = GetRowHeaderBounds(panel);

            if (r.Width > 0 && r.Height > 0)
            {
                if (SuperGrid.DoPreRenderColumnHeaderEvent(g,
                    this, null, RenderParts.RowHeader, r) == false)
                {
                    using (Brush br = style.RowHeader.Background.GetBrush(r))
                        g.FillRectangle(br, r);

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

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

                    if (panel.TopLeftHeaderSelectBehavior != TopLeftHeaderSelectBehavior.NoSelection)
                    {
                        RenderRowHeaderIndicator(g, panel, style, r);
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(_RowHeaderText) == false)
                            RenderRowHeaderText(g, _RowHeaderText, style, r);
                    }

                    SuperGrid.DoPostRenderColumnHeaderEvent(g,
                        this, null, RenderParts.RowHeader, r);
                }
            }
        }
        /// <summary>
        /// Returns the copy of the style.
        /// </summary>
        /// <returns>Copy of the style.</returns>
        public new GridPanelVisualStyle Copy()
        {
            GridPanelVisualStyle style = new GridPanelVisualStyle();

            CopyTo(style);

            return (style);
        }
示例#9
0
        private void RenderRowHeader(Graphics g,
            GridPanel panel, FilterRowVisualStyle style, GridPanelVisualStyle pstyle)
        {
            Rectangle r = GetRowHeaderBounds(panel);

            if (r.Width > 0 && r.Height > 0)
            {
                if (SuperGrid.DoPreRenderFilterRowEvent(g,
                    this, null, RenderParts.RowHeader, r) == false)
                {
                    using (Brush br = style.RowHeader.Background.GetBrush(r))
                        g.FillRectangle(br, r);

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

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

                    RenderFilterIndicator(g, panel, r);

                    SuperGrid.DoPostRenderFilterRowEvent(g,
                        this, null, RenderParts.RowHeader, r);
                }
            }
        }
示例#10
0
        /// <summary>
        /// Handles invocation of GetPanelStyle events
        /// </summary>
        internal void DoGetPanelStyleEvent(
            GridPanel gridPanel, ref GridPanelVisualStyle style)
        {
            if (GetPanelStyle != null)
            {
                GridGetPanelStyleEventArgs ev = new
                    GridGetPanelStyleEventArgs(gridPanel, style);

                GetPanelStyle(this, ev);

                style = ev.Style;
            }
        }
示例#11
0
 protected virtual void RenderBorder(Graphics g,
     GridPanel panel, GridPanelVisualStyle pstyle, Rectangle r)
 {
     using (Pen pen = new Pen(pstyle.HeaderLineColor))
     {
         g.DrawLine(pen, r.X, r.Y - 1, r.Right - 1, r.Y - 1);
         g.DrawLine(pen, r.X, r.Bottom - 1, r.Right - 1, r.Bottom - 1);
     }
 }
示例#12
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);
            }
        }
示例#13
0
        /// <summary>
        /// Returns the copy of the style.
        /// </summary>
        /// <returns>Copy of the style.</returns>
        public void CopyTo(GridPanelVisualStyle copy)
        {
            base.CopyTo(copy);

            copy.Alignment = _Alignment;
            copy.AllowWrap = _AllowWrap;

            copy.HeaderLineColor = _HeaderLineColor;
            copy.TreeLineColor = _TreeLineColor;
            copy.HorizontalLineColor = _HorizontalLineColor;
            copy.VerticalLineColor = _VerticalLineColor;

            copy.TreeLinePattern = _TreeLinePattern;
            copy.HorizontalLinePattern = _HorizontalLinePattern;
            copy.VerticalLinePattern = _VerticalLinePattern;
            copy.HeaderHLinePattern = _HeaderHLinePattern;
            copy.HeaderVLinePattern = _HeaderVLinePattern;

            if (_CircleTreeButtonStyle != null)
                copy.CircleTreeButtonStyle = _CircleTreeButtonStyle.Copy();

            if (_SquareTreeButtonStyle != null)
                copy.SquareTreeButtonStyle = _SquareTreeButtonStyle.Copy();

            if (_TriangleTreeButtonStyle != null)
                copy.TriangleTreeButtonStyle = _TriangleTreeButtonStyle.Copy();
        }
示例#14
0
        private void RenderRoundedBox(Graphics g, GroupByVisualStyle style,
            ColumnHeaderVisualStyle cstyle, GridPanelVisualStyle pstyle,
            GridGroupBox leftBox, GridGroupBox box, int radius)
        {
            Rectangle r = box.Bounds;

            using (GraphicsPath path = GetRoundedPath(r, radius))
            {
                SmoothingMode sm = g.SmoothingMode;
                g.SmoothingMode = SmoothingMode.AntiAlias;

                if (_UseColumnHeaderColors == true)
                {
                    using (Brush br = cstyle.Background.GetBrush(r))
                        g.FillPath(br, path);

                    using (Pen pen = new Pen(pstyle.HeaderLineColor))
                        g.DrawPath(pen, path);
                }
                else
                {
                    using (Brush br = style.GroupBoxBackground.GetBrush(r))
                        g.FillPath(br, path);

                    using (Pen pen = new Pen(style.GroupBoxBorderColor))
                        g.DrawPath(pen, path);
                }

                if (leftBox != null)
                {
                    Region oldClip = g.Clip;
                    Region newClip = new Region(Bounds);

                    newClip.Exclude(path);

                    g.SetClip(newClip, CombineMode.Intersect);

                    try
                    {
                        if (SuperGrid.DoPreRenderGroupBoxConnectorEvent(g, this, leftBox, box) == false)
                        {
                            RenderBoxConnector(g, style, leftBox.Bounds, box.Bounds, true);

                            SuperGrid.DoPostRenderGroupBoxConnectorEvent(g, this, leftBox, box);
                        }
                    }
                    finally
                    {
                        g.Clip = oldClip;
                    }
                }

                g.SmoothingMode = sm;
            }
        }
示例#15
0
        private void RenderGroupBox(GridPanel panel,
            GridGroupBox box, GridGroupBox lastBox, Graphics g, GridPanelVisualStyle pstyle)
        {
            StyleType type = GetGroupByStyleType(box);

            ColumnHeaderVisualStyle cstyle = panel.ColumnHeader.GetEffectiveStyle(box.Column, type);
            GroupByVisualStyle style = GetGroupByEffectiveStyle(box);

            Rectangle r = box.Bounds;

            if (r.Width > 0 && r.Height > 0)
            {
                if (SuperGrid.DoPreRenderGroupBoxEvent(g,
                    this, box, RenderParts.Background, r) == false)
                {
                    int radius = GetCornerRadius(box);

                    if (radius > 0 && box.GroupBoxStyle == GroupBoxStyle.RoundedRectangular)
                        RenderRoundedBox(g, style, cstyle, pstyle, lastBox, box, radius);
                    else
                        RenderRectBox(g, style, cstyle, pstyle, lastBox, box);

                    SuperGrid.DoPostRenderGroupBoxEvent(g,
                        this, box, RenderParts.Background, r);
                }

                Rectangle t = r;

                RenderSortImage(g, panel, box, ref t);
                RenderFilterImage(g, panel, box, ref t);

                int n = box.Padding.Left + TextHPad;

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

                if (t.Width - box.ContentSize.Width > 0)
                    t.Width = box.ContentSize.Width;

                if (SuperGrid.DoPreRenderGroupBoxEvent(g,
                    this, box, RenderParts.Content, t) == false)
                {
                    Rectangle t2 = t;

                    t.Y += box.Padding.Top;
                    t.Height = box.Column.HeaderTextSize.Height + 6;

                    RenderText(g, box.Column, style, cstyle, t);

                    SuperGrid.DoPostRenderGroupBoxEvent(g,
                        this, box, RenderParts.Content, t2);
                }
            }
        }
示例#16
0
        private void RenderRectBox(Graphics g, GroupByVisualStyle style,
            ColumnHeaderVisualStyle cstyle, GridPanelVisualStyle pstyle,
            GridGroupBox leftBox, GridGroupBox box)
        {
            Rectangle r = box.Bounds;

            if (_UseColumnHeaderColors == true)
            {
                using (Brush br = cstyle.Background.GetBrush(r))
                    g.FillRectangle(br, r);

                using (Pen pen = new Pen(pstyle.HeaderLineColor))
                    g.DrawRectangle(pen, r);
            }
            else
            {
                using (Brush br = style.GroupBoxBackground.GetBrush(r))
                    g.FillRectangle(br, r);

                using (Pen pen = new Pen(style.GroupBoxBorderColor))
                    g.DrawRectangle(pen, r);
            }

            if (leftBox != null)
            {
                if (SuperGrid.DoPreRenderGroupBoxConnectorEvent(g, this, leftBox, box) == false)
                {
                    RenderBoxConnector(g, style, leftBox.Bounds, r, false);

                    SuperGrid.DoPostRenderGroupBoxConnectorEvent(g, this, leftBox, box);
                }
            }
        }
示例#17
0
        static void DrawLower(Graphics g,
            GridPanelVisualStyle style, Pen pen, Rectangle r)
        {
            int x = r.X + r.Width / 2;
            int y = r.Y + r.Height / 2;

            if (style.TreeLinePattern == LinePattern.Dot)
            {
                if (y % 2 == 0)
                    y--;
            }

            g.DrawLine(pen, x, y, x, r.Bottom);
        }
示例#18
0
        static void DrawDash(Graphics g, GridContainer item, GridPanelVisualStyle style,
            Pen pen, Rectangle r, Rectangle t, int n, bool hasButton)
        {
            int x = r.X + r.Width / 2 + 1;
            int y = r.Y + r.Height / 2;

            GridPanel ppanel = item.GetParentPanel();

            if (ppanel.CheckBoxes == true && item.ShowCheckBox == false)
            {
                r.Width += ppanel.CheckBoxSize.Width;

                if (item is GridPanel)
                    r.Width += 4;
            }

            if (t.Width > 0 && r.Right > t.Left - n)
                r.Width -= r.Right - (t.Left - n);
            
            if (r.Width > 0)
            {
                if (style.TreeLinePattern == LinePattern.Dot)
                {
                    x++;

                    if (hasButton == false)
                    {
                        if (y % 2 == 0)
                            y--;
                    }
                    else
                    {
                        y -= 2;
                    }
                }

                g.DrawLine(pen, x, y, r.Right, y);
            }
        }
示例#19
0
 ///<summary>
 /// GridGetPanelStyleEventArgs
 ///</summary>
 ///<param name="gridPanel"></param>
 ///<param name="style"></param>
 public GridGetPanelStyleEventArgs(GridPanel gridPanel, GridPanelVisualStyle style)
     : base(gridPanel)
 {
     _Style = style;
 }
示例#20
0
        private void RenderRowHeader(Graphics g, GridPanel panel,
            GridContainer item, GridPanelVisualStyle pstyle, Rectangle r, bool highlight)
        {
            r.Width--;
            r.Height--;

            if (r.Width > 0 && r.Height > 0)
            {
                StyleState rowState = GetRowHeaderState(item, r);
                RowVisualStyle style = GetEffectiveRowStyle(item, rowState);

                if (SuperGrid.DoPreRenderRowEvent(g, this, RenderParts.RowHeader, r) == false)
                {
                    if (item.IsActiveRow == true &&
                        (panel.ActiveRowIndicatorStyle == ActiveRowIndicatorStyle.Highlight ||
                         panel.ActiveRowIndicatorStyle == ActiveRowIndicatorStyle.Both))
                    {
                        using (Brush br = style.RowHeaderStyle.ActiveRowBackground.GetBrush(r))
                            g.FillRectangle(br, r);
                    }
                    else
                    {
                        using (Brush br = style.RowHeaderStyle.Background.GetBrush(r))
                            g.FillRectangle(br, r);
                    }

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

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

                    if (item is GridRow)
                    {
                        if (RowDirty == true && panel.ShowRowDirtyMarker == true)
                        {
                            Rectangle t = r;

                            t.X++;
                            t.Width = 3;


                            using (Brush br = style.RowHeaderStyle.DirtyMarkerBackground.GetBrush(t))
                                g.FillRectangle(br, t);
                        }
                    }

                    r.Width = panel.RowHeaderWidth;

                    RenderHeaderInfo(g, panel, item, style, r);

                    SuperGrid.DoPostRenderRowEvent(g, this, RenderParts.RowHeader, r);
                }
            }
        }
示例#21
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;
                }
            }
        }
示例#22
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);
                    }
                }
            }
        }
示例#23
0
        protected virtual void RenderRowHeader(Graphics g,
            GridPanel panel, GridPanelVisualStyle pstyle, Rectangle r)
        {
            if (CanShowRowHeader(panel) == true)
            {
                r.X -= panel.RowHeaderWidth;
                r.Width = panel.RowHeaderWidth - 1;

                TextRowVisualStyle style = GetEffectiveRowHeaderStyle();

                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, r.Y, r.Right, r.Y);
                    g.DrawLine(pen, r.X, r.Y, r.X, r.Bottom);
                }

                using (Pen pen = new Pen(pstyle.HeaderLineColor))
                {
                    g.DrawLine(pen, r.X, r.Y - 1, r.Right, r.Y - 1);
                    g.DrawLine(pen, r.X, r.Bottom - 1, r.Right, r.Bottom - 1);
                    g.DrawLine(pen, r.Right, r.Y, r.Right, r.Bottom - 1);
                }
            }
        }
示例#24
0
        /// <summary>
        /// Applies the style to instance of this style.
        /// </summary>
        /// <param name="style">Style to apply.</param>
        public void ApplyStyle(GridPanelVisualStyle style)
        {
            if (style != null)
            {
                base.ApplyStyle(style);

                if (style.Alignment != Alignment.NotSet)
                    _Alignment = style.Alignment;

                if (style.AllowWrap != Tbool.NotSet)
                    _AllowWrap = style.AllowWrap;

                if (style._CircleTreeButtonStyle != null)
                    CircleTreeButtonStyle.ApplyStyle(style._CircleTreeButtonStyle);

                if (style.HeaderLineColor.IsEmpty == false)
                    _HeaderLineColor = style.HeaderLineColor;

                if (style.TreeLineColor.IsEmpty == false)
                    _TreeLineColor = style.TreeLineColor;

                if (style.HorizontalLineColor.IsEmpty == false)
                    _HorizontalLineColor = style.HorizontalLineColor;

                if (style.VerticalLineColor.IsEmpty == false)
                    _VerticalLineColor = style.VerticalLineColor;

                if (style.TreeLinePattern != LinePattern.NotSet)
                    TreeLinePattern = style.TreeLinePattern;

                if (style.HorizontalLinePattern != LinePattern.NotSet)
                    HorizontalLinePattern = style.HorizontalLinePattern;

                if (style._SquareTreeButtonStyle != null)
                    SquareTreeButtonStyle.ApplyStyle(style._SquareTreeButtonStyle);

                if (style._TriangleTreeButtonStyle != null)
                    TriangleTreeButtonStyle.ApplyStyle(style._TriangleTreeButtonStyle);
                
                if (style.VerticalLinePattern != LinePattern.NotSet)
                    VerticalLinePattern = style.VerticalLinePattern;

                if (style.HeaderHLinePattern != LinePattern.NotSet)
                    HeaderHLinePattern = style.HeaderHLinePattern;

                if (style.HeaderVLinePattern != LinePattern.NotSet)
                    HeaderVLinePattern = style.HeaderVLinePattern;
            }
        }