Remove Default Span and Scrollbars from RadRichTextBox

2 posts, 0 answers
  1. Doug
    Doug avatar
    1 posts
    Member since:
    Apr 2013

    Posted 10 Apr 2013 Link to this post

    I am trying to utilize the RadRichTextBox in Winforms for the purpose of having the integrated spell checker, but I am only in need of a 1-line text box.  I can't seem to find a way to remove the scroll bars when I do that.  Is there a way to do this?

    Then, I have figured out how to add a section to the RadRichTextBox.Document by using the .AddBefore(), but is there a way to actually remove the first section completely from the default Document that is created?

    Thanks,
    Doug
  2. Jack
    Admin
    Jack avatar
    2333 posts

    Posted 12 Apr 2013 Link to this post

    Hello Doug,

    If you want just to use the spell checking feature, then the best option is to work with RadTextBoxControl. The following article from our online documentation describes how to spell check a textbox.

    If you still want to use RadRichTextBox, then you can hide all scrollbars by handling the RadPropertyChanging event. You should cancel the changing action when the editor tries to set the Visibility property to Visible. Consider the sample below:
    radRichTextBox1.RichTextBoxElement.VScrollBar.Visibility = ElementVisibility.Collapsed;
    radRichTextBox1.RichTextBoxElement.HScrollBar.Visibility = ElementVisibility.Collapsed;
     
    radRichTextBox1.RichTextBoxElement.VScrollBar.RadPropertyChanging += new RadPropertyChangingEventHandler(ScrollBar_RadPropertyChanging);
    radRichTextBox1.RichTextBoxElement.HScrollBar.RadPropertyChanging += new RadPropertyChangingEventHandler(ScrollBar_RadPropertyChanging);
     
    void ScrollBar_RadPropertyChanging(object sender, RadPropertyChangingEventArgs args)
    {
        if (args.Property == RadElement.VisibilityProperty && (ElementVisibility)args.NewValue == ElementVisibility.Visible)
        {
            args.Cancel = true;
        }
    }

    I hope this helps. Do not hesitate to ask If you have further questions.

    All the best,
    Jack
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Back to Top