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

Single Line RichTextBox

1 Answer 101 Views
RichTextBox (obsolete as of Q3 2014 SP1)
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 19 Sep 2014, 07:00 PM
Is it possible to have a single line rich text box without showing scrollbars?

I ideally want to use it for the user to enter a hyperlink and click on it to go to that web page.

Thanks

Andez

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 24 Sep 2014, 08:52 AM
Hello Andez,

Thank you for writing.

This is possible but it is not recommended because if the text length exceeds the control length you will be unable to properly scroll and see the entire text:
void Form1_Load(object sender, EventArgs e)
{
    radRichTextBox1.AcceptsReturn = true;
    radRichTextBox1.AutoScroll = false;
 
    radRichTextBox1.RichTextBoxElement.VScrollBar.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
    radRichTextBox1.RichTextBoxElement.VScrollBar.RadPropertyChanging += VScrollBar_RadPropertyChanging;
}
 
void VScrollBar_RadPropertyChanging(object sender, Telerik.WinControls.RadPropertyChangingEventArgs args)
{
    if (args.Property.Name == "Visibility")
    {
        args.Cancel = true;
    }
}

Directly entering link in the text box will not insert it. To insert a hyperlink you can use the insert hyperlink method or show the insert hyperlink dialog:
private void radButton1_Click(object sender, EventArgs e)
{
    radRichTextBox1.InsertHyperlink(new HyperlinkInfo() { NavigateUri = "www.telerik.com" }, "Telerik");
    //or
    radRichTextBox1.DocumentView.ShowInsertHyperlinkDialog();
}

I hope this helps.

Regards,
Dimitar
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
RichTextBox (obsolete as of Q3 2014 SP1)
Asked by
Paul
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or