Exemplo n.º 1
0
        static void FillPaletteLine(CodedColor color, int index, Worksheet sheet, Stylesheet stylesheet, PatternGridPainter gridPainter, int row, int startCol)
        {
            var textStyle = new Style();

            textStyle.Borders = new Borders();
            textStyle.Borders.Top.BorderStyle = BorderStyles.Thin;
            textStyle.Borders.Top.Color       = GridPainterSettings.Default.Line10Argb;
            textStyle = stylesheet.AddStyle(textStyle);

            var symbolStyle = new Style();

            symbolStyle.Borders = new Borders();
            symbolStyle.Borders.Top.BorderStyle = BorderStyles.Thin;
            symbolStyle.Borders.Top.Color       = GridPainterSettings.Default.Line10Argb;
            symbolStyle.Font = new Font {
                Name = gridPainter.SymbolsFont.Name
            };
            symbolStyle = stylesheet.AddStyle(symbolStyle);

            var colorStyle = new Style();

            colorStyle.Borders = new Borders();
            colorStyle.Borders.Top.BorderStyle = BorderStyles.Thin;
            colorStyle.Borders.Top.Color       = GridPainterSettings.Default.Line10Argb;
            colorStyle.Fill = new Fill(GdiColor.FromArgb(color.Argb));
            colorStyle      = stylesheet.AddStyle(colorStyle);

            SetColorLineCell(index.ToString(), textStyle, sheet, row, startCol);
            SetColorLineCell(color.SymbolChar.ToString(), symbolStyle, sheet, row, startCol + 1);
            SetColorLineCell(color.ColorCode, textStyle, sheet, row, startCol + 2);
            SetColorLineCell(" ", colorStyle, sheet, row, startCol + 3);
            SetColorLineCell(color.ColorName, textStyle, sheet, row, startCol + 4);
            SetColorLineCell(color.OccurrencesCount.ToString(), textStyle, sheet, row, startCol + 5);
        }
Exemplo n.º 2
0
        static Style GetVerticalRulerCellStyle(Stylesheet stylesheet, CodedImage image, int y, PatternGridPainter gridPainter)
        {
            var style = new Style();

            style.Alignment = new Alignment {
                HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Middle, WrapText = false
            };
            style.Font = new Font {
                Size = 10, Color = GridPainterSettings.Default.NumbersArgb
            };

            style.Borders = new Borders();

            style.Borders.Top.BorderStyle = GetBorderStyle(y, image.Size.Height);
            style.Borders.Top.Color       = GetBorderColor(y, image.Size.Height);

            style.Borders.Bottom.BorderStyle = GetBorderStyle(y + 1, image.Size.Height);
            style.Borders.Bottom.Color       = GetBorderColor(y + 1, image.Size.Height);

            style.Borders.Left.BorderStyle = BorderStyles.None;

            style.Borders.Right.BorderStyle = BorderStyles.Medium;
            style.Borders.Right.Color       = GridPainterSettings.Default.Line10Argb;

            style.Borders.Diagonal.BorderStyle = BorderStyles.None;

            return(stylesheet.AddStyle(style));
        }
Exemplo n.º 3
0
        static Style GetCrossCellStyle(Stylesheet stylesheet, CodedImage image, int x, int y, PatternGridPainter gridPainter)
        {
            var codedColor = image[x, y];

            var style = new Style();

            //style.NumberFormat = new NumberFormat("");
            style.Alignment = new Alignment {
                HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Middle, WrapText = false
            };
            style.Fill = new Fill {
                Color = GdiColor.FromArgb(gridPainter.GetBackColorArgb(codedColor))
            };
            style.Font = new Font {
                Name = gridPainter.SymbolsFont.Name, Size = 10, Color = GdiColor.FromArgb(gridPainter.GetSymbolColorArgb(codedColor))
            };

            style.Borders = new Borders();

            style.Borders.Top.BorderStyle = GetBorderStyle(y, image.Size.Height);
            style.Borders.Top.Color       = GetBorderColor(y, image.Size.Height);

            style.Borders.Bottom.BorderStyle = GetBorderStyle(y + 1, image.Size.Height);
            style.Borders.Bottom.Color       = GetBorderColor(y + 1, image.Size.Height);

            style.Borders.Left.BorderStyle = GetBorderStyle(x, image.Size.Width);
            style.Borders.Left.Color       = GetBorderColor(x, image.Size.Width);

            style.Borders.Right.BorderStyle = GetBorderStyle(x + 1, image.Size.Width);
            style.Borders.Right.Color       = GetBorderColor(x + 1, image.Size.Width);

            style.Borders.Diagonal.BorderStyle = BorderStyles.None;

            return(stylesheet.AddStyle(style));
        }
Exemplo n.º 4
0
        /// <inheritdoc />
        public Stylesheet Visit(CommonTree tree)
        {
            var stylesheet = new Stylesheet();

            foreach (CommonTree child in tree.Children)
            {
                if (child.Text == MapCssStrings.Rule)
                {
                    var style = VisitStyle(child);
                    stylesheet.AddStyle(style);
                }
            }

            return(stylesheet);
        }
Exemplo n.º 5
0
        static void CreateColorsListHeader(Worksheet sheet, Stylesheet stylesheet, int startRow, int startCol)
        {
            var headerStyle = stylesheet.AddStyle(
                new Style
            {
                Font = new Font {
                    Style = FontStyles.Bold, Color = GridPainterSettings.Default.NumbersArgb
                }
            });

            SetColorHeaderCell("#", headerStyle, 10, sheet, startRow, startCol);
            SetColorHeaderCell(" ", headerStyle, 6, sheet, startRow, startCol + 1);
            SetColorHeaderCell("Code", headerStyle, 15, sheet, startRow, startCol + 2);
            SetColorHeaderCell("Color", headerStyle, 10, sheet, startRow, startCol + 3);
            SetColorHeaderCell("Name", headerStyle, 25, sheet, startRow, startCol + 4);
            SetColorHeaderCell("Count", headerStyle, 12, sheet, startRow, startCol + 5);
        }