Ejemplo n.º 1
0
        private void SetForegroundColor(DataHighlightColor color)
        {
            var selectedColumns = _table.GetSelectedDataColumnIndexes(_clickedColumnIndex);

            _stylingOptions.ForegroundColors = DataHighlightColors.UpdateColorStringRange(_stylingOptions.ForegroundColors, selectedColumns, color, _table.DataColumnCount);
            _table.ClearSelection();
        }
Ejemplo n.º 2
0
        private static char GetCharRepresentation(this DataHighlightColor color)
        {
            switch (color)
            {
            case DataHighlightColor.Red: return('r');

            case DataHighlightColor.Green: return('g');

            case DataHighlightColor.Blue: return('b');

            default: return(' ');
            }
        }
Ejemplo n.º 3
0
        public static string GetDisplayName(this DataHighlightColor item)
        {
            switch (item)
            {
            case DataHighlightColor.None: return("Data");

            case DataHighlightColor.Inactive: return("Data - Inactive");

            case DataHighlightColor.Red: return("Data - Red Highlight");

            case DataHighlightColor.Green: return("Data - Green Highlight");

            case DataHighlightColor.Blue: return("Data - Blue Highlight");
            }
            throw new NotImplementedException();
        }
Ejemplo n.º 4
0
 public (Color fg, Color bg, bool bold) GetHighlightInfo(DataHighlightColor highlight)
 {
     ThreadHelper.ThrowIfNotOnUIThread();
     return(GetInfo(highlight.GetDisplayName()));
 }
Ejemplo n.º 5
0
        public static string UpdateColorStringRange(string colorString, IEnumerable <int> indexes, DataHighlightColor newColor, int columnCount)
        {
            StringBuilder colors = new StringBuilder(columnCount);

            if (colorString?.Length == columnCount)
            {
                colors.Append(colorString);
            }
            else
            {
                colors.Append(' ', columnCount);
            }

            foreach (var i in indexes)
            {
                if (i >= 0 && i < columnCount)
                {
                    colors[i] = newColor.GetCharRepresentation();
                }
            }

            colorString = colors.ToString();
            if (string.IsNullOrWhiteSpace(colorString))
            {
                return("");
            }
            return(colorString);
        }