The ConsoleOutput.WriteFormatted Method

The format string paramter passed to this method is a string of desired output text marked up with format codes. The codes can be either string replacement placeholders, or framework format commands.

A string replacement placeholder is a sequential number in braces:
  • {0}

A framework format command is a slash followed by a command letter in brackets, with an optional number parameter:
  • \[@#] e.g. \[n] or \[c16]

The valid format commands are:
  • c = Text Color, Color Number (required, 0-15, or 16 for default)
  • b = Back Color, Color Number (required, 0-15, or 16 for default)
  • r = Cursor Right, Integer Amount (required, number of spaces to move)
  • l = Cursor Left, Integer Amount (required, number of spaces to move)
  • n = New Line, Integer Amount (optional, number of new lines, or 1 by default)

When embedded within a string passed to the WriteFormatted method, these format command will be interpreted as changes in the output display.

When string replacement placeholders are used, the WriteFormatted method must also be supplied with a number of value parameters equal to the number of placeholders used. (this functionality is identical to String.Format).

Last edited May 17, 2012 at 10:13 PM by ReedKimble, version 1

Comments

No comments yet.