Place the richTextBox control on the form
Set form name as Form1
Set richTextBox name as richTextBox1
If you do not want to allow user to copy the text set richTextBox1 ShortcutsEnabled property to False
Go to Project->Add Component, enter name of the component ReadOnlyRichTextBox.cs
Then open ReadOnlyRichTextBox.cs and paste following code:
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace <Replace with your app namespace>
{
public partial class ReadOnlyRichTextBox : RichTextBox
{
[DllImport("user32.dll")]
static extern bool HideCaret(IntPtr hWnd);
public ReadOnlyRichTextBox()
{
this.ReadOnly = true;
}
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
HideCaret(this.Handle);
}
}
}
From Solution Explorer open your "Form1.Designer.cs" and replace in this file the following lines:
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
with
this.richTextBox1 = new ReadOnlyRichTextBox();
and
private System.Windows.Forms.RichTextBox richTextBox1;
with
private ReadOnlyRichTextBox richTextBox1;