Exemplo n.º 1
0
 internal void CopyFrom(RtfCharFormat src)
 {
     if (src == null)
     {
         return;
     }
     Begin = src.Begin;
     End   = src.End;
     if (Font == null && src.Font != null)
     {
         Font = new FontDescriptor(src.Font.Value);
     }
     if (AnsiFont == null && src.AnsiFont != null)
     {
         AnsiFont = new FontDescriptor(src.AnsiFont.Value);
     }
     if (FontSize < 0 && src.FontSize >= 0)
     {
         FontSize = src.FontSize;
     }
     if (FontStyle.IsEmpty && !src.FontStyle.IsEmpty)
     {
         FontStyle = new FontStyle(src.FontStyle);
     }
     if (BgColor == null && src.BgColor != null)
     {
         BgColor = new ColorDescriptor(src.BgColor.Value);
     }
     if (FgColor == null && src.FgColor != null)
     {
         FgColor = new ColorDescriptor(src.FgColor.Value);
     }
 }
Exemplo n.º 2
0
 public void SetHeaderBorderColors(ColorDescriptor colorOuter, ColorDescriptor colorInner)
 {
     for (var j = 0; j < ColCount; j++)
     {
         _cells[0][j].Borders[Direction.Top].Color    = colorOuter;
         _cells[0][j].Borders[Direction.Bottom].Color = colorInner;
         if (j == 0)
         {
             // The first column
             _cells[0][j].Borders[Direction.Right].Color = colorInner;
             _cells[0][j].Borders[Direction.Left].Color  = colorOuter;
         }
         else if (j == ColCount - 1)
         {
             // The last column
             _cells[0][j].Borders[Direction.Right].Color = colorOuter;
             _cells[0][j].Borders[Direction.Left].Color  = colorInner;
         }
         else
         {
             _cells[0][j].Borders[Direction.Right].Color = colorInner;
             _cells[0][j].Borders[Direction.Left].Color  = colorInner;
         }
     }
 }
Exemplo n.º 3
0
 public void SetBorderColor(ColorDescriptor color)
 {
     Borders[Direction.Top].Color    = color;
     Borders[Direction.Bottom].Color = color;
     Borders[Direction.Left].Color   = color;
     Borders[Direction.Right].Color  = color;
 }
Exemplo n.º 4
0
 /// <summary>
 ///     Sets ALL inner borders as specified
 /// </summary>
 /// <param name="style"></param>
 /// <param name="width"></param>
 /// <param name="color"></param>
 public void SetInnerBorder(BorderStyle style, float width, ColorDescriptor color)
 {
     for (var i = 0; i < RowCount; i++)
     {
         for (var j = 0; j < ColCount; j++)
         {
             if (i == 0)
             {
                 // The first row
                 _cells[i][j].Borders[Direction.Bottom].Style = style;
                 _cells[i][j].Borders[Direction.Bottom].Width = width;
                 _cells[i][j].Borders[Direction.Bottom].Color = color;
             }
             else if (i == RowCount - 1)
             {
                 // The last row
                 _cells[i][j].Borders[Direction.Top].Style = style;
                 _cells[i][j].Borders[Direction.Top].Width = width;
                 _cells[i][j].Borders[Direction.Top].Color = color;
             }
             else
             {
                 _cells[i][j].Borders[Direction.Top].Style    = style;
                 _cells[i][j].Borders[Direction.Top].Width    = width;
                 _cells[i][j].Borders[Direction.Top].Color    = color;
                 _cells[i][j].Borders[Direction.Bottom].Style = style;
                 _cells[i][j].Borders[Direction.Bottom].Color = color;
                 _cells[i][j].Borders[Direction.Bottom].Width = width;
             }
             if (j == 0)
             {
                 // The first column
                 _cells[i][j].Borders[Direction.Right].Style = style;
                 _cells[i][j].Borders[Direction.Right].Width = width;
                 _cells[i][j].Borders[Direction.Right].Color = color;
             }
             else if (j == ColCount - 1)
             {
                 // The last column
                 _cells[i][j].Borders[Direction.Left].Style = style;
                 _cells[i][j].Borders[Direction.Left].Width = width;
                 _cells[i][j].Borders[Direction.Left].Color = color;
             }
             else
             {
                 _cells[i][j].Borders[Direction.Right].Style = style;
                 _cells[i][j].Borders[Direction.Right].Width = width;
                 _cells[i][j].Borders[Direction.Right].Color = color;
                 _cells[i][j].Borders[Direction.Left].Style  = style;
                 _cells[i][j].Borders[Direction.Left].Width  = width;
                 _cells[i][j].Borders[Direction.Left].Color  = color;
             }
         }
     }
 }
Exemplo n.º 5
0
 /// <summary>
 ///     Sets ALL outer borders as specified
 /// </summary>
 /// <param name="style"></param>
 /// <param name="width"></param>
 /// <param name="color"></param>
 public void SetOuterBorder(BorderStyle style, float width, ColorDescriptor color)
 {
     for (var i = 0; i < ColCount; i++)
     {
         _cells[0][i].Borders[Direction.Top].Style = style;
         _cells[0][i].Borders[Direction.Top].Width = width;
         _cells[0][i].Borders[Direction.Top].Color = color;
         _cells[RowCount - 1][i].Borders[Direction.Bottom].Style = style;
         _cells[RowCount - 1][i].Borders[Direction.Bottom].Width = width;
         _cells[RowCount - 1][i].Borders[Direction.Bottom].Color = color;
     }
     for (var i = 0; i < RowCount; i++)
     {
         _cells[i][0].Borders[Direction.Left].Style             = style;
         _cells[i][0].Borders[Direction.Left].Width             = width;
         _cells[i][0].Borders[Direction.Left].Color             = color;
         _cells[i][ColCount - 1].Borders[Direction.Right].Style = style;
         _cells[i][ColCount - 1].Borders[Direction.Right].Width = width;
         _cells[i][ColCount - 1].Borders[Direction.Right].Color = color;
     }
 }
Exemplo n.º 6
0
 /// <summary>
 ///     Internal use only.
 ///     Default constructor that sets border style to None.
 /// </summary>
 internal Border()
 {
     Style = BorderStyle.None;
     Width = 0.5F;
     Color = new ColorDescriptor(0);
 }