简体   繁体   中英

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.

Try to solve it with

    Multiline = True
    WordWrap = False

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

I can reproduce this behaviour with

MultiLine = false

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

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.

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.

This worked for me:

WordWrap = false;
ScrollBars = RichTextBoxScrollBars.Both;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM