* Merge winforms framework content to working branch (#14) * Breadcrumb / TOC / Move net5 to net folder (#15) * change path from net5 to net * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Add .net 5 winforms placeholder article (#16) * added some metadata and adjusted net5 placeholder * corrections * corrections * corrections * Test1 * Swapping landing page vs concept * fix links * Fix links * Fix desc
3.6 KiB
title, ms.date, helpviewer_keywords, ms.assetid
| title | ms.date | helpviewer_keywords | ms.assetid | |||
|---|---|---|---|---|---|---|
| Display Scroll Bars in RichTextBox Control | 03/30/2017 |
|
cdeb42e1-86e8-410c-ba46-18aec264ef5f |
How to: Display Scroll Bars in the Windows Forms RichTextBox Control
By default, the Windows Forms xref:System.Windows.Forms.RichTextBox control displays horizontal and vertical scroll bars as necessary. There are seven possible values for the xref:System.Windows.Forms.RichTextBox.ScrollBars%2A property of the xref:System.Windows.Forms.RichTextBox control, which are described in the table below.
To display scroll bars in a RichTextBox control
-
Set the xref:System.Windows.Forms.RichTextBox.Multiline%2A property to
true. No type of scroll bar, including horizontal, will display if the xref:System.Windows.Forms.RichTextBox.Multiline%2A property is set tofalse. -
Set the xref:System.Windows.Forms.RichTextBox.ScrollBars%2A property to an appropriate value of the xref:System.Windows.Forms.RichTextBoxScrollBars enumeration.
Value Description xref:System.Windows.Forms.RichTextBoxScrollBars.Both (default) Displays horizontal or vertical scroll bars, or both, only when text exceeds the width or length of the control. xref:System.Windows.Forms.RichTextBoxScrollBars.None Never displays any type of scroll bar. xref:System.Windows.Forms.RichTextBoxScrollBars.Horizontal Displays a horizontal scroll bar only when the text exceeds the width of the control. (For this to occur, the xref:System.Windows.Forms.TextBoxBase.WordWrap%2A property must be set to false.)xref:System.Windows.Forms.RichTextBoxScrollBars.Vertical Displays a vertical scroll bar only when the text exceeds the height of the control. xref:System.Windows.Forms.RichTextBoxScrollBars.ForcedHorizontal Displays a horizontal scroll bar when the xref:System.Windows.Forms.TextBoxBase.WordWrap%2A property is set to false. The scroll bar appears dimmed when text does not exceed the width of the control.xref:System.Windows.Forms.RichTextBoxScrollBars.ForcedVertical Always displays a vertical scroll bar. The scroll bar appears dimmed when text does not exceed the length of the control. xref:System.Windows.Forms.RichTextBoxScrollBars.ForcedBoth Always displays a vertical scrollbar. Displays a horizontal scroll bar when the xref:System.Windows.Forms.TextBoxBase.WordWrap%2A property is set to false. The scroll bars appear grayed when text does not exceed the width or length of the control. -
Set the xref:System.Windows.Forms.TextBoxBase.WordWrap%2A property to an appropriate value.
Value Description falseText in the control is not automatically adjusted to fit the width of the control, so it will scroll to the right until a line break is reached. Use this value if you chose horizontal scroll bars or both, above. true(default)Text in the control is automatically adjusted to fit the width of the control. The horizontal scrollbar will not appear. Use this value if you chose vertical scroll bars or none, above, to display one or more paragraphs.