///<summary>
 /// GridGetColumnHeaderRowHeaderStyleEventArgs
 ///</summary>
 ///<param name="gridPanel"></param>
 ///<param name="columnHeader"></param>
 ///<param name="styleType"></param>
 ///<param name="style"></param>
 public GridGetColumnHeaderRowHeaderStyleEventArgs(GridPanel gridPanel,
     GridColumnHeader columnHeader, StyleType styleType, ColumnHeaderRowVisualStyle style)
     : base(gridPanel)
 {
     _ColumnHeader = columnHeader;
     _StyleType = styleType;
     _Style = style;
 }
        /// <summary>
        /// Handles invocation of GetColumnHeader RowHeader events
        /// </summary>
        internal void DoGetColumnHeaderRowHeaderStyleEvent(
            GridColumnHeader columnHeader, StyleType eStyle, ref ColumnHeaderRowVisualStyle style)
        {
            if (GetColumnHeaderRowHeaderStyle != null)
            {
                GridGetColumnHeaderRowHeaderStyleEventArgs ev = new
                    GridGetColumnHeaderRowHeaderStyleEventArgs(columnHeader.GridPanel, columnHeader, eStyle, style);

                GetColumnHeaderRowHeaderStyle(this, ev);

                style = ev.Style;
            }
        }
        private void InitColumnHeaderStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
        {
            ColumnHeaderRowVisualStyle style = new ColumnHeaderRowVisualStyle();

            style.FilterBorderColor = factory.GetColor(0x697D96);
            style.FilterBackground = new Background(Color.White, factory.GetColor(0x5B92FF), 0);

            style.WhiteSpaceBackground = new Background(factory.GetColor(0xCFDDEE));

            style.RowHeader.Background = new Background(
                factory.GetColor(0xEFF5FB), factory.GetColor(0xE2EDFA), BackFillType.ForwardDiagonal);

            style.RowHeader.BorderHighlightColor = GetBorderHighlight(factory);

            style.IndicatorBackground = new Background(factory.GetColor(0x4488E5));
            style.IndicatorBorderColor = factory.GetColor(0x1F48A1);

            visualStyle.ColumnHeaderRowStyles[StyleType.Default] = style;

            style = style.Copy();

            style.FilterBorderColor = factory.GetColor(Color.Green);
            style.FilterBackground = new Background(Color.White, factory.GetColor(Color.Green), 0);

            visualStyle.ColumnHeaderRowStyles[StyleType.Selected] = style;

            style = style.Copy();

            style.FilterBorderColor = factory.GetColor(0x697D96);
            style.FilterBackground = new Background(Color.White, factory.GetColor(0xE2AA00), 0);

            style.RowHeader.Background = new Background(
                factory.GetColor(0xFFDF6B), factory.GetColor(0xFFFCE6), BackFillType.Angle);

            visualStyle.ColumnHeaderRowStyles[StyleType.MouseOver] = style;
            visualStyle.ColumnHeaderRowStyles[StyleType.SelectedMouseOver] = style;
        }
        private void InitColumnHeaderStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
        {
            ColumnHeaderRowVisualStyle style = new ColumnHeaderRowVisualStyle();

            style.FilterBorderColor = factory.GetColor(Color.LightGray);
            style.FilterBackground = new Background(Color.White, factory.GetColor(Color.LightGray), 0);

            style.WhiteSpaceBackground = new Background(factory.GetColor(0x797979));
            style.RowHeader.Background = new Background(factory.GetColor(0x6A6A6A), factory.GetColor(0x595959), BackFillType.ForwardDiagonal);

            style.RowHeader.BorderHighlightColor = GetBorderHighlight(factory);

            style.IndicatorBackground = new Background(factory.GetColor(0xF9FAFB), factory.GetColor(0xD7DAE2), BackFillType.Angle);
            style.IndicatorBorderColor = factory.GetColor(0xBDCFE8);

            visualStyle.ColumnHeaderRowStyles[StyleType.Default] = style;
            
            style = style.Copy();

            style.FilterBorderColor = factory.GetColor(Color.LightGreen);
            style.FilterBackground = new Background(Color.White, factory.GetColor(Color.Green), 45);

            visualStyle.ColumnHeaderRowStyles[StyleType.Selected] = style;

            style = style.Copy();

            style.FilterBorderColor = factory.GetColor(0x797979);
            style.FilterBackground = new Background(Color.White, factory.GetColor(0xE2AA00), 0);

            style.RowHeader.Background = new Background(factory.GetColor(0x8E8E8E));

            visualStyle.ColumnHeaderRowStyles[StyleType.MouseOver] = style;
            visualStyle.ColumnHeaderRowStyles[StyleType.SelectedMouseOver] = style;
        }
        private ColumnHeaderRowVisualStyle GetRowHeaderStyle(StyleType e)
        {
            if (_EffectiveRowHeaderStyles == null)
                _EffectiveRowHeaderStyles = new ColumnHeaderRowVisualStyles();

            if (_EffectiveRowHeaderStyles.IsValid(e) == false)
            {
                ColumnHeaderRowVisualStyle style = new ColumnHeaderRowVisualStyle();

                StyleType[] css = style.GetApplyStyleTypes(e);

                if (css != null)
                {
                    foreach (StyleType cs in css)
                    {
                        style.ApplyStyle(SuperGrid.BaseVisualStyles.ColumnHeaderRowStyles[cs]);
                        style.ApplyStyle(SuperGrid.DefaultVisualStyles.ColumnHeaderRowStyles[cs]);
                        style.ApplyStyle(GridPanel.DefaultVisualStyles.ColumnHeaderRowStyles[cs]);
                    }
                }

                SuperGrid.DoGetColumnHeaderRowHeaderStyleEvent(this, e, ref style);

                if (style.RowHeader.Background == null || style.RowHeader.Background.IsEmpty == true)
                    style.RowHeader.Background = new Background(Color.WhiteSmoke);

                _EffectiveRowHeaderStyles[e] = style;
            }

            return (_EffectiveRowHeaderStyles[e]);
        }
        private void InitColumnHeaderStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
        {
            ColumnHeaderRowVisualStyle style = new ColumnHeaderRowVisualStyle();
            MetroPartColors metroColors = _MetroPartColors;

            style.FilterBorderColor = factory.GetColor(metroColors.CanvasColorDarkShade);

            style.FilterBackground = new Background(
                Color.White, factory.GetColor(metroColors.CanvasColorDarkShade), 0);

            style.WhiteSpaceBackground = new Background(factory.GetColor(metroColors.CanvasColor));

            style.RowHeader.Background = new
                Background(factory.GetColor(metroColors.CanvasColorLighterShade));

            style.RowHeader.BorderHighlightColor = GetBorderHighlight();

            style.IndicatorBackground = new Background(factory.GetColor(metroColors.ComplementColor));
            style.IndicatorBorderColor = factory.GetColor(metroColors.ComplementColorDark);

            visualStyle.ColumnHeaderRowStyles[StyleType.Default] = style;

            style = style.Copy();

            style.FilterBorderColor = factory.GetColor(metroColors.ComplementColor);

            style.FilterBackground = new Background(
                Color.White, factory.GetColor(metroColors.ComplementColor), 45);

            visualStyle.ColumnHeaderRowStyles[StyleType.Selected] = style;

            style = style.Copy();

            style.FilterBorderColor = factory.GetColor(metroColors.CanvasColorDarkShade);
            
            style.FilterBackground = new Background(
                Color.White, factory.GetColor(metroColors.BaseColorDark), 0);

            style.RowHeader.Background = new Background(
                factory.GetColor(metroColors.CanvasColorLightShade));

            visualStyle.ColumnHeaderRowStyles[StyleType.MouseOver] = style;
            visualStyle.ColumnHeaderRowStyles[StyleType.SelectedMouseOver] = style;
        }
        private void RenderRowHeaderText(Graphics g,
            string text, ColumnHeaderRowVisualStyle style, Rectangle r)
        {
            Font font = style.RowHeader.Font ?? SystemFonts.DefaultFont;

            Size tSize = TextHelper.MeasureText(g, text, font);

            r.Inflate(-2, -2);

            eTextFormat tf = ((r.Width <= tSize.Width)
                  ? eTextFormat.Left
                  : eTextFormat.HorizontalCenter) | eTextFormat.NoPadding;

            tf |= eTextFormat.WordBreak | eTextFormat.VerticalCenter;

            TextDrawing.DrawString(g, text,
                font, style.RowHeader.TextColor, r, tf);
        }
        private void RenderRowHeaderIndicator(Graphics g,
            GridPanel panel, ColumnHeaderRowVisualStyle style, Rectangle r)
        {
            r.Inflate(-3, -3);

            if (r.Width > 0 && r.Height > 0)
            {
                using (GraphicsPath path = new GraphicsPath())
                {
                    int n = Math.Min(r.Width, r.Height);

                    if (n > 10)
                        n = 10;

                    Point[] pts = new Point[3];

                    if (_SelectAllCount != panel.SelectionUpdateCount)
                    {
                        r.X--;
                        r.Y--;

                        pts[0] = new Point(r.Right, r.Bottom - n);
                        pts[1] = new Point(r.Right, r.Bottom);
                        pts[2] = new Point(r.Right - n, r.Bottom);
                    }
                    else
                    {
                        pts[0] = new Point(r.X, r.Y);
                        pts[1] = new Point(r.X + n, r.Y);
                        pts[2] = new Point(r.X, r.Y + n);

                        r.X++;
                        r.Y++;
                    }

                    path.AddPolygon(pts);
                    path.CloseFigure();

                    if (style.IndicatorBackground.GradientAngle % 45 == 0)
                        n /= 2;

                    r.Width = n - 1;
                    r.Height = n - 1;

                    if (n > 0)
                    {
                        g.SmoothingMode = SmoothingMode.AntiAlias;

                        using (Brush br = style.IndicatorBackground.GetBrush(r))
                        {
                            if (br is LinearGradientBrush)
                                ((LinearGradientBrush) br).WrapMode = WrapMode.Tile;

                            g.FillPath(br, path);
                        }

                        using (Pen pen = new Pen(style.IndicatorBorderColor))
                            g.DrawPath(pen, path);
                    }
                }
            }
        }
        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);
                }
            }
        }
Beispiel #10
0
 private void RenderRowBackground(
     Graphics g, ColumnHeaderRowVisualStyle style, Rectangle bounds)
 {
     using (Brush br = style.WhiteSpaceBackground.GetBrush(bounds))
             g.FillRectangle(br, bounds);
 }
        private void InitColumnHeaderStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
        {
            ColumnHeaderRowVisualStyle style = new ColumnHeaderRowVisualStyle();

            style.FilterBorderColor = factory.GetColor(0x787D87);
            style.FilterBackground = new Background(Color.White, factory.GetColor(0xB0B6BC), 0);

            style.WhiteSpaceBackground = new Background(factory.GetColor(0xE9EDF1));

            style.RowHeader.Background = new Background(
                factory.GetColor(0xF5F7F9), factory.GetColor(0xEFF2F6), BackFillType.ForwardDiagonal);

            style.RowHeader.BorderHighlightColor = GetBorderHighlight(factory);

            style.IndicatorBackground = new Background(factory.GetColor(0xB0B6BC));
            style.IndicatorBorderColor = factory.GetColor(0x787D87);

            visualStyle.ColumnHeaderRowStyles[StyleType.Default] = style;

            style = style.Copy();

            style.FilterBorderColor = factory.GetColor(Color.Green);
            style.FilterBackground = new Background(Color.White, factory.GetColor(Color.Green), 45);

            visualStyle.ColumnHeaderRowStyles[StyleType.Selected] = style;

            style = style.Copy();

            style.FilterBorderColor = factory.GetColor(0x797979);
            style.FilterBackground = new Background(Color.White, factory.GetColor(0xE2AA00), 0);

            style.RowHeader.Background = new Background(
                factory.GetColor(0xFFDF6B), factory.GetColor(0xFFFCE6), BackFillType.Angle);

            visualStyle.ColumnHeaderRowStyles[StyleType.MouseOver] = style;
            visualStyle.ColumnHeaderRowStyles[StyleType.SelectedMouseOver] = style;
        }