Qsiris
Qsiris

Reputation: 1183

RichTextBox horizontal scroll not working

I have a single line readOnly RichTextBox with wordWrap disabled, and I add programmatically one single very long line of text.

However the horizontal scrollBar does not apear, even if I set ScrollBars to ForcedHorizontal.

How can I fix this?

I can navigate through the whole line if i use the arrow keys on the keyboard, but this only makes things worse.

Upvotes: 9

Views: 11875

Answers (5)

Imgt
Imgt

Reputation: 1

This worked for me:

WordWrap = false;
ScrollBars = RichTextBoxScrollBars.Both;

Upvotes: 0

Hamdy Ahmed
Hamdy Ahmed

Reputation: 39

You have to Set the Multiline property to true. Check this text from MSDN:

To display scroll bars in a RichTextBox control Set the Multiline property to true. No type of scroll bar, including horizontal, will display if the Multiline property is set to false.

Set the ScrollBars property to an appropriate value of the RichTextBoxScrollBars enumeration.

Upvotes: 0

Saransh89
Saransh89

Reputation: 1

I was facing the issue with vertical scroll Bar. If Rich textbox is inside any control like TabPage etc, than in that situation you need to set dock == fill for the RickTextbox.

Upvotes: 0

TVC
TVC

Reputation: 472

Try to solve it with

    Multiline = True
    WordWrap = False

Change this properties to allow the multiline feature and also allow Horizontal scrolling

Upvotes: 12

Steve
Steve

Reputation: 216243

I can reproduce this behaviour with

MultiLine = false

If I change this property to True the scrollbar appears as expected

Upvotes: 4

Related Questions