C# ScrollBars Control

A ScrollBar allows you to view content that is outside of the current viewing area by sliding the Thumb to make the content visible.

C# scrollbars

The ScrollBar control contains a Track control. The Track control consists of a Thumb control and two RepeatButton controls. You can increase and decrease the Value property of the ScrollBar control by pressing the RepeatButton controls or by moving the Thumb. You can set the Value property yourself in code, which moves the scroll box to match. The Minimum and Maximum properties determine the range of values that the control can display. The default range of values for the Value property is from 0 to 1.

The following C# program shows a TextBox control with scrollbars.

Full Source C#
using System; using System.Drawing; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { textBox1.Multiline = true; textBox1.ScrollBars = ScrollBars.Both; } } }