Пример #1
0
 ///<summary>
 /// GridGetCellStyleEventArgs
 ///</summary>
 ///<param name="gridPanel"></param>
 ///<param name="gridRow"></param>
 ///<param name="styleType"></param>
 ///<param name="style"></param>
 public GridGetRowStyleEventArgs(
     GridPanel gridPanel, GridContainer gridRow, StyleType styleType, RowVisualStyle style)
     : base(gridPanel, gridRow)
 {
     _StyleType = styleType;
     _Style = style;
 }
Пример #2
0
        /// <summary>
        /// Handles invocation of GetRowStyle events
        /// </summary>
        internal void DoGetRowStyleEvent(
            GridContainer gridRow, StyleType eStyle, ref RowVisualStyle style)
        {
            if (GetRowStyle != null)
            {
                GridGetRowStyleEventArgs ev = new
                    GridGetRowStyleEventArgs(gridRow.GridPanel, gridRow, eStyle, style);

                GetRowStyle(this, ev);

                style = ev.Style;
            }
        }
        private RowVisualStyle GetMouseOverRowStyle(ColorFactory factory)
        {
            RowVisualStyle rowStyle = new RowVisualStyle();
            rowStyle.Background = new Background(Color.White);

            RowHeaderVisualStyle style = new RowHeaderVisualStyle();
            style.Background = new Background(Color.Plum);
            style.ActiveRowBackground = new Background(Color.Blue);

            Background bg = new Background();
            BackColorBlend bcb = new BackColorBlend();

            bcb.Colors = new Color[3];
            bcb.Colors[0] = factory.GetColor(0xFFE575);
            bcb.Colors[1] = factory.GetColor(0xFFE575);
            bcb.Colors[2] = factory.GetColor(0xF2CD66);

            bcb.Positions = new float[3];
            bcb.Positions[0] = 0f;
            bcb.Positions[1] = .75f;
            bcb.Positions[2] = 1f;

            bg.BackColorBlend = bcb;
            bg.GradientAngle = 0;

            style.Background = bg;
            style.TextColor = factory.GetColor(0x444444);

            bg = new Background();
            bcb = new BackColorBlend();

            bcb.Colors = new Color[3];
            bcb.Colors[0] = Color.FromArgb(254 - 20, 240 - 20, 214 - 20);
            bcb.Colors[1] = Color.FromArgb(254 - 30, 199 - 30, 104 - 30);
            bcb.Colors[2] = Color.FromArgb(229 - 30, 133 - 30, 0);

            bcb.Positions = new float[3];
            bcb.Positions[0] = 0f;
            bcb.Positions[1] = .75f;
            bcb.Positions[2] = 1f;

            bg.BackColorBlend = bcb;
            bg.GradientAngle = 0;

            style.ActiveRowBackground = bg;

            rowStyle.RowHeaderStyle = style;

            return (rowStyle);
        }
        private RowVisualStyle GetSelectedMouseOverRowStyle(DefaultVisualStyles visualStyle, ColorFactory factory)
        {
            RowVisualStyle rowStyle = new RowVisualStyle();
            rowStyle.Background = GetDefaultSelectedBackground(factory);

            RowHeaderVisualStyle style = new RowHeaderVisualStyle();
            style.Background = new Background(factory.GetColor(0xBABABA));
            style.ActiveRowBackground = new Background(factory.GetColor(0xBABABA));
            style.TextColor = factory.GetColor(0x444444);

            rowStyle.RowHeaderStyle = style;

            visualStyle.RowStyles[StyleType.Selected] = rowStyle;

            rowStyle = new RowVisualStyle();
            rowStyle.Background = GetSelectedColumnMouseOverBackground(factory);

            style = new RowHeaderVisualStyle();
            style.Background = new Background(factory.GetColor(0xFFEB91));
            style.ActiveRowBackground = new Background(factory.GetColor(0xB7DBFF));

            rowStyle.RowHeaderStyle = style;

            return (rowStyle);
        }
Пример #5
0
        private RowVisualStyle GetSelectedMouseOverRowStyle(DefaultVisualStyles visualStyle, ColorFactory factory)
        {
            MetroPartColors metroColors = _MetroPartColors;

            RowVisualStyle rowStyle = new RowVisualStyle();
            rowStyle.Background = GetDefaultSelectedBackground(factory);

            RowHeaderVisualStyle style = new RowHeaderVisualStyle();
            style.Background = new Background(metroColors.BaseColor);
            style.ActiveRowBackground = new Background(metroColors.BaseColor);

            rowStyle.RowHeaderStyle = style;

            visualStyle.RowStyles[StyleType.Selected] = rowStyle;

            rowStyle = new RowVisualStyle();
            rowStyle.Background = GetSelectedColumnMouseOverBackground();

            style = new RowHeaderVisualStyle();
            style.Background = new Background(metroColors.BaseColor);
            style.ActiveRowBackground = new Background(metroColors.BaseColor);

            rowStyle.RowHeaderStyle = style;

            return (rowStyle);
        }
        private RowVisualStyle GetDefaultRowStyle(ColorFactory factory)
        {
            RowVisualStyle rowStyle = new RowVisualStyle();
            rowStyle.Background = new Background(factory.GetColor(Color.White));

            RowHeaderVisualStyle style = new RowHeaderVisualStyle();

            style.Font = SystemFonts.DefaultFont;
            style.TextColor = factory.GetColor(0x1E395B);

            Background bg = new Background();
            BackColorBlend bcb = new BackColorBlend();

            bcb.Colors = new Color[3];
            bcb.Colors[0] = factory.GetColor(0x6A6A6A);
            bcb.Colors[1] = factory.GetColor(0x6A6A6A);
            bcb.Colors[2] = factory.GetColor(0x5E5E5E);

            bcb.Positions = new float[3];
            bcb.Positions[0] = 0f;
            bcb.Positions[1] = .75f;
            bcb.Positions[2] = 1f;

            bg.BackColorBlend = bcb;
            bg.GradientAngle = 0;

            style.Background = bg;
            style.TextColor = factory.GetColor(0xE2E2E2);

            bg = new Background(factory.GetColor(0x6A6A6A));

            style.ActiveRowBackground = bg;
            style.DirtyMarkerBackground = new Background(factory.GetColor(0xAE054F), factory.GetColor(0xE75E94), BackFillType.VerticalCenter);
            style.BorderHighlightColor = GetBorderHighlight(factory);

            rowStyle.RowHeaderStyle = style;

            return (rowStyle);
        }
Пример #7
0
        private RowVisualStyle GetMouseOverRowStyle()
        {
            MetroPartColors metroColors = _MetroPartColors;

            RowVisualStyle rowStyle = new RowVisualStyle();
            rowStyle.Background = new Background(metroColors.CanvasColor);

            RowHeaderVisualStyle style = new RowHeaderVisualStyle();
            style.Background = new Background(metroColors.CanvasColorLighterShade);
            style.ActiveRowBackground = new Background(metroColors.CanvasColorLightShade);

            Background bg = new Background(metroColors.CanvasColorLightShade);
            style.Background = bg;

            bg = new Background(metroColors.BaseColor);
            style.ActiveRowBackground = bg;

            rowStyle.RowHeaderStyle = style;

            return (rowStyle);
        }
Пример #8
0
        private RowVisualStyle GetDefaultRowStyle()
        {
            MetroPartColors metroColors = _MetroPartColors;

            RowVisualStyle rowStyle = new RowVisualStyle();
            rowStyle.Background = new Background(metroColors.CanvasColor);

            RowHeaderVisualStyle style = new RowHeaderVisualStyle();

            style.Font = SystemFonts.DefaultFont;
            style.TextColor = metroColors.TextColor;

            Background bg = new Background(metroColors.CanvasColorLighterShade);
            style.Background = bg;

            bg = new Background(metroColors.BaseColor);
            style.ActiveRowBackground = bg;
            style.DirtyMarkerBackground = new Background(metroColors.BaseColorDarker);
            style.BorderHighlightColor = GetBorderHighlight();

            rowStyle.RowHeaderStyle = style;

            return (rowStyle);
        }
Пример #9
0
        private void RenderGridIndex(Graphics g,
            string text, RowVisualStyle style, Rectangle r, int m)
        {
            Font font = style.RowHeaderStyle.Font ?? SystemFonts.DefaultFont;

            r.Inflate(-2, 0);
            r.Width -= m;

            eTextFormat tf = style.RowHeaderStyle.GetTextFormatFlags();

            TextDrawing.DrawString(g, text,
                font, style.RowHeaderStyle.TextColor, r, tf);
        }
Пример #10
0
        private void RenderHeaderInfo(Graphics g,
            GridPanel panel, GridContainer item, RowVisualStyle style, Rectangle r)
        {
            r.X += 4;
            r.Width -= 4;

            GridRow row = item as GridRow;

            int m = RenderInfoImage(g, panel, item, r);

            if (row != null && row.IsInsertRow == true)
            {
                RenderInsertIndicator(g, panel, r);
                RenderIndicatorImage(g, panel, item, r);
            }
            else
            {
                if (panel.ShowEditingImage == true &&
                    (row != null && row.EditorDirty == true))
                {
                    RenderEditingImage(g, panel, r);
                }
                else
                {
                    int n = RenderIndicatorImage(g, panel, item, r);

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

                    string text = item.RowHeaderText;

                    if (string.IsNullOrEmpty(text) == true)
                    {
                        text = (panel.ShowRowGridIndex == true)
                           ? (item.GridIndex + panel.RowHeaderIndexOffset).ToString() : "";
                    }

                    SuperGrid.DoGetRowHeaderTextEvent(item, ref text);

                    if (string.IsNullOrEmpty(text) == false)
                        RenderGridIndex(g, text, style, r, m);
                }
            }
        }
Пример #11
0
        private RowVisualStyle GetRowStyle(GridContainer item, StyleType e)
        {
            if (_EffectiveRowStyles.IsValid(e) == false)
            {
                RowVisualStyle style = new RowVisualStyle();

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

                if (css != null)
                {
                    GridPanel panel = GridPanel;

                    foreach (StyleType cs in css)
                    {
                        style.ApplyStyle(SuperGrid.BaseVisualStyles.RowStyles[cs]);
                        style.ApplyStyle(SuperGrid.DefaultVisualStyles.RowStyles[cs]);
                        style.ApplyStyle(GridPanel.DefaultVisualStyles.RowStyles[cs]);
                        style.ApplyStyle(item.RowStyles[cs]);

                        if (panel != null && panel.UseAlternateRowStyle == true)
                        {
                            if ((GridIndex % 2) > 0)
                            {
                                style.ApplyStyle(SuperGrid.BaseVisualStyles.AlternateRowCellStyles[cs]);
                                style.ApplyStyle(SuperGrid.DefaultVisualStyles.AlternateRowCellStyles[cs]);
                                style.ApplyStyle(GridPanel.DefaultVisualStyles.AlternateRowCellStyles[cs]);
                            }
                        }

                        style.ApplyStyle(item.CellStyles[cs]);
                        style.ApplyStyle(item.CellStyles[cs]);
                    }
                }

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

                RowHeaderVisualStyle style2 = style.RowHeaderStyle;
                SuperGrid.DoGetRowHeaderStyleEvent(this, e, ref style2);

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

                _EffectiveRowStyles[e] = style;
            }

            return (_EffectiveRowStyles[e]);
        }