Example #1
0
        internal void PaintColumnHeaders(TreeRenderer renderer, ColumnHeaderCollection columns, Graphics g, bool treeControlHeader)
        {
            ColumnHeaderRendererEventArgs ce = new ColumnHeaderRendererEventArgs();
            ce.Graphics = g;
            ce.Tree = this.Tree;
            ce.SortIndicatorColor = renderer.ColorTable.ColumnSortIndicatorColor;

            ElementStyle defaultNormalStyle = GetDefaultColumnStyleNormal(renderer);
            ElementStyle headerStyle = null;
            if(treeControlHeader)
                headerStyle = this.Tree.ColumnsBackgroundStyle == null ? GetDefaultHeaderStyle(renderer) : this.Tree.ColumnsBackgroundStyle;
            else
                headerStyle = this.Tree.NodesColumnsBackgroundStyle == null ? GetDefaultNodesHeaderStyle(renderer) : this.Tree.NodesColumnsBackgroundStyle;

            if (Tree.ColumnStyleNormal != null && Tree.ColumnStyleNormal.Custom)
                defaultNormalStyle = Tree.ColumnStyleNormal;

            Point offset = Point.Empty;
            if (this.Tree.AutoScroll)
            {
                offset = this.Tree.GetAutoScrollPositionOffset();
                if (treeControlHeader)
                    offset.Y = 0;
            }

            Rectangle columnsBounds = columns.Bounds;
            if (!treeControlHeader) columnsBounds.Offset(offset);
            ElementStyleDisplayInfo di = new ElementStyleDisplayInfo(headerStyle, g, columnsBounds);
            ElementStyleDisplay.Paint(di);
            Color columnSeparator = (headerStyle != null && !headerStyle.BorderColor.IsEmpty) ? headerStyle.BorderColor : Color.Empty;
            for (int i = 0; i < columns.Count; i++)
            {
                ColumnHeader column = columns.ColumnAtDisplayIndex(i);
                if (!column.Visible) continue;
                ElementStyle style = null;
                if (column.StyleNormal != "")
                    style = Tree.Styles[column.StyleNormal].Copy();
                else
                    style = defaultNormalStyle.Copy();

                if (column.IsMouseDown)
                {
                    if (column.StyleMouseDown != "")
                        style.ApplyStyle(Tree.Styles[column.StyleMouseDown]);
                    else if (Tree.ColumnStyleMouseDown != null)
                        style.ApplyStyle(Tree.ColumnStyleMouseDown);
                }
                else if (column.IsMouseOver)
                {
                    if (column.StyleMouseOver != "")
                        style.ApplyStyle(Tree.Styles[column.StyleMouseOver]);
                    else if (Tree.ColumnStyleMouseOver != null)
                        style.ApplyStyle(Tree.ColumnStyleMouseOver);
                }

                ce.ColumnHeader = column;
                Rectangle columnBounds = column.Bounds;
                columnBounds.Offset(offset);
                ce.Bounds = columnBounds;
                ce.Style = style;
                renderer.DrawColumnHeader(ce);
                if (!columnSeparator.IsEmpty)
                    DisplayHelp.DrawLine(g, columnBounds.Right - (column.IsLastVisible ? 0 : 1), columnBounds.Y, columnBounds.Right - (column.IsLastVisible ? 0 : 1), columnBounds.Bottom - 1, columnSeparator, 1);
            }
        }
Example #2
0
 private ElementStyle GetDefaultNodesHeaderStyle(TreeRenderer renderer)
 {
     if (renderer != null && renderer.Office2007ColorTable != null)
     {
         return renderer.Office2007ColorTable.StyleClasses[ElementStyleClassKeys.TreeNodesColumnsHeaderKey] as ElementStyle;
     }
     else
     {
         ElementStyle style = new ElementStyle();
         style.BackColor = ColorScheme.GetColor(0xF9FCFD);
         style.BackColor2 = ColorScheme.GetColor(0xD3DBE9);
         style.BackColorGradientAngle = 90;
         style.TextColor = ColorScheme.GetColor(0x000000);
         style.BorderColor = ColorScheme.GetColor(0x9EB6CE);
         style.BorderBottom = eStyleBorderType.Solid;
         style.BorderBottomWidth = 1;
         style.BorderLeft = eStyleBorderType.Solid;
         style.BorderLeftWidth = 1;
         style.BorderTop = eStyleBorderType.Solid;
         style.BorderTopWidth = 1;
         return style;
     }
 }
Example #3
0
 private ElementStyle GetDefaultColumnStyleNormal(TreeRenderer renderer)
 {
     if (renderer != null && renderer.Office2007ColorTable != null)
     {
         return renderer.Office2007ColorTable.StyleClasses[ElementStyleClassKeys.TreeColumnKey] as ElementStyle;
     }
     else
     {
         ElementStyle style = new ElementStyle();
         style.TextColor = ColorScheme.GetColor(0x000000);
         return style;
     }
 }