title: How to display text in different colors
body: <p>I am trying to create GUI using windows from application in c#. I have started recently. I have one problem in displaying some text information.</p>
  
  <p>I am getting multiple sensors data, each sensor having the name and number and data. here i am able to get all sensors data into "_sensordata".</p>
  
  <p>I able to print what ever the data coming from sensors in block color, for that purpose the below code is working perfectly. The problem is i want to put some conditions for each sensor data to display text in different color.</p>
  
  <p>For example i have one sensor with name "Temperature". presently the temperature data and name of temperature sensor is displaying in block color. Now when the temperature is less than "0" or greater than "150" i want to display the value in "red color". I am not getting how to display like that. I have same type of conditions for each sensor,So how can implement this. I want to display the "sensorData.EngText" in "block" color if it is in between the range else i need to display in "red" color (for all sensors).</p>
  
  <p>I have the below rich text format code so can any one suggest me how to add color to one of the text in the below code.</p>
  
  <pre><code>if (Display != null)
                      {        //UpdateDisplay1();
                          StringBuilder text = new StringBuilder();
                          text.Append("{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1044");
                          text.Append("{\\fonttbl{\\f0\\fnil Tahoma;}}");
                          text.Append("{\\colortbl;\\red0\\green0\\blue0;\\red255\\green0\\blue0;\\red255\\green255\\blue0;}");
  
                          text.Append("\\viewkind4\\uc1\\pard");
                          text.Append("{\\tx100\\tx2100\\tx4100\\tx6100\\tx8100\\tx10100");
                          text.Append("\\tx12100\\tx14100\\tx16100\\tx18100\\tx20100}");
                          text.Append("\\fs20\\ql\\b");
                          text.Append(string.Format("\\tab {0}", e.Data.SensorName));
                          text.Append("\\par\\fs35\\ql\\b0");
                          text.Append(string.Format("\\tab {0}", e.Data.EngText));
  
                          if (Display.InvokeRequired)
                          {
                              Display.Invoke((MethodInvoker)delegate { Display.Rtf = text.ToString(); });
                          }
                          else
                          {
                              Display.Rtf = text.ToString();
                          }
                      }
  </code></pre>