This is a migrated thread and some comments may be shown as answers.

Context Menu

2 Answers 82 Views
RichTextBox (obsolete as of Q3 2014 SP1)
This is a migrated thread and some comments may be shown as answers.
Alan
Top achievements
Rank 1
Alan asked on 25 Jan 2012, 10:39 AM
Is there a right click/context menu available for the Rich text box?  If so where can I find the documentation?

Alan

2 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 27 Jan 2012, 02:33 PM
Hi Alan,

RadRichTextBox has no default context menu attached. However, you can add one with a few lines of code by handling the MouseDown event. Here is a sample:
RadDropDownMenu menu = new RadDropDownMenu();
menu.Items.Add(new RadMenuItem("Item 1"));
menu.Items.Add(new RadMenuItem("Item 2"));
menu.Items.Add(new RadMenuItem("Item 3"));
 
this.radRichTextBox1.MouseDown += new MouseEventHandler(radRichTextBox1_MouseDown);
 
void radRichTextBox1_MouseDown(object sender, MouseEventArgs e)
{
    if (e.Button == System.Windows.Forms.MouseButtons.Right)
    {
        menu.Show(Control.MousePosition);
    }
}

Greetings,

Jack
the Telerik team

SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

0
Chris Ward
Top achievements
Rank 1
answered on 18 Sep 2012, 03:47 PM
I found this solution quite useful, thanks Jack!
Tags
RichTextBox (obsolete as of Q3 2014 SP1)
Asked by
Alan
Top achievements
Rank 1
Answers by
Jack
Telerik team
Chris Ward
Top achievements
Rank 1
Share this question
or