Let us look at a simple C# Windows Forms VScrollBar example.
Example 1: VScrollBar
This example will comprise the following files:
VScrollBar.cs
Step 1: Create Project
- The first step is to create a C# Project.
- Go to
FILE-->New-->Project
to create a new project.
Step 2: Write Code
Write Code as follows:
*(a). VScrollBar.cs
Create a file named VScrollBar.cs
Here is the full code
using System;
using System.Windows.Forms;
namespace Examples {
class MainForm : Form {
public static void Main() {
Application.EnableVisualStyles();
Application.Run(new MainForm());
}
public MainForm() {
Text = "VScrollBar example";
scrollBar1.Parent = this;
scrollBar1.Location = new System.Drawing.Point(30, 10);
scrollBar2.Parent = this;
scrollBar2.Location = new System.Drawing.Point(70, 10);
scrollBar2.Minimum = 0;
scrollBar2.Value = 100;
scrollBar2.Maximum = 200;
scrollBar2.Height = 220;
}
private VScrollBar scrollBar1 = new VScrollBar();
private VScrollBar scrollBar2 = new VScrollBar();
}
}
Run
Simply copy the source code into your C# Project,Build and Run. Alternatively download the code using the links provided below, then open the .csproj
project, build and run.
Reference
Download the code using the below links:
Number | Link |
---|---|
1. | Download Example |
2. | Follow code author |