CentralServerDemo.ExRichTextBox.GetColorTable C# (CSharp) Method

GetColorTable() private method

Creates a font table from the RtfColor structure. When an Insert or Append operation is performed, _textColor and _backColor are either specified or the default is used. In any case, on any Insert or Append, only three colors are used. The default color of the RichTextBox (signified by a semicolon (;) without a definition), is always the first color (index 0) in the color table. The second color is always the text color, and the third is always the highlight color (color behind the text). The color table should have the form ... {\colortbl ;[TEXT_COLOR];[HIGHLIGHT_COLOR];}
private GetColorTable ( RtfColor _textColor, RtfColor _backColor ) : string
_textColor RtfColor
_backColor RtfColor
return string
        private string GetColorTable(RtfColor _textColor, RtfColor _backColor) {

            StringBuilder _colorTable = new StringBuilder();

            // Append color table control string and default font (;)
            _colorTable.Append(@"{\colortbl ;");

            // Append the text color
            _colorTable.Append(rtfColor[_textColor]);
            _colorTable.Append(@";");

            // Append the highlight color
            _colorTable.Append(rtfColor[_backColor]);
            _colorTable.Append(@";}\n");
					
            return _colorTable.ToString();
        }