Scrolling Telerik RadTextBox When Needed - Not RadTextBoxControl

459 views Asked by At

I'll try and explain what I'm after.
I have a multiline RadTextBox, (takes about 7 lines of text). I do n't want to show scroll bars as I start to type.
When the text gets to the 8th line either via enter or wordwrap to make the vertical scroll bar appear.

I can do this with a RadRichTextbox or RadTextBoxControl, but need to use a RadTextBox.
Is this possible?
I have tried using the .lines property but that doesn't increment when using word wrap.
Any help much appreciated.

1

There are 1 answers

1
Dess On

RadTextBox from the Telerik UI for WinForms suite internally hosts the standard MS TextBox. Hence, if you want to scroll the multiline text in it, you should do it in a similar way as in the MS TextBox. The TextBox.ScrollBars Property controls which scroll bars should appear in a multiline TextBox control. You can set it to ScrollBars.Vertical. Then, you can either use the up/down arrow buttons on the keyboard or the vertical scrollbar to navigate through the multiple lines:

        this.radTextBox1.Multiline = true; 
        this.radTextBox1.AutoSize = false;
        this.radTextBox1.Size = new Size(50, 50);
        this.radTextBox1.TextBoxElement.TextBoxItem.TextBoxControl.ScrollBars = ScrollBars.Vertical;

Here is the result

I hope this information helps.