Пример #1
0
        private void OnSeriesSymbolRendering(object sender, RenderSymbolEventArgs e)
        {
            if (e.Series == null && e.Series.Name == null)
            {
                return;
            }

            var args = new ItemFormattingEventArgs(e.Index, e.Series.Name);

            ItemFormatting?.Invoke(this, args);

            style = args.Style;
            if (style != null)
            {
                var backColor = style.BackColor;
                if (!backColor.IsEmpty)
                {
                    e.Engine.SetFill(backColor.ToArgb());
                }

                var borderColor = args.Style.BorderColor;
                if (!borderColor.IsEmpty)
                {
                    e.Engine.SetStroke(borderColor.ToArgb());
                }
            }
        }
Пример #2
0
        private void FormattablePieChart_SliceRendering(object sender, RenderSliceEventArgs e)
        {
            var pie  = (IPieChart)this;
            var args = new ItemFormattingEventArgs(e.Index, Binding);

            ItemFormatting?.Invoke(this, args);

            style = args.Style;
            if (style != null)
            {
                var backColor = style.BackColor;
                if (!backColor.IsEmpty)
                {
                    e.Engine.SetFill(backColor.ToArgb());
                }

                var borderColor = args.Style.BorderColor;
                if (!borderColor.IsEmpty)
                {
                    e.Engine.SetStroke(borderColor.ToArgb());
                }
            }
        }
Пример #3
0
        protected override void OnCellPainting(DataGridViewCellPaintingEventArgs e)
        {
            var columnIndex = e.ColumnIndex;
            var rowIndex    = e.RowIndex;

            if (columnIndex >= 0 && rowIndex >= 0)
            {
                var ifea = new ItemFormattingEventArgs(rowIndex, Columns[columnIndex].DataPropertyName);
                ItemFormatting?.Invoke(this, ifea);

                var ruleStyle = ifea?.Style;
                if (ruleStyle != null)
                {
                    var cellStyle = e.CellStyle;

                    var backColor = ruleStyle.BackColor;
                    if (!backColor.IsEmpty)
                    {
                        cellStyle.BackColor = backColor;
                    }

                    var foreColor = ruleStyle.ForeColor;
                    if (!foreColor.IsEmpty)
                    {
                        cellStyle.ForeColor = foreColor;
                    }

                    var fontStyle = ruleStyle.FontStyle;
                    if (cellStyle.Font.Style != fontStyle && fontStyle != FontStyle.Regular)
                    {
                        cellStyle.Font = new Font(cellStyle.Font, fontStyle);
                    }
                }
            }

            base.OnCellPainting(e);
        }