using System.Windows.Forms;
namespace TestProgressBar
public partial class Form1 : Form
VerticalProgressBar vp = new VerticalProgressBar();
vp.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
vp.Location = new System.Drawing.Point(3, 3);
vp.Name = "progressBar1";
vp.Size = new System.Drawing.Size(382, 207);
vp.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
this.tableLayoutPanel1.Controls.Add(vp, 1, 1);
private void trackBar1_ValueChanged(object sender, EventArgs e)
progressBar1.Value = trackBar1.Value;
vp.Value = trackBar1.Value;
public class VerticalProgressBar : ProgressBar
public VerticalProgressBar()
this.SetStyle(ControlStyles.UserPaint, true);
protected override void OnPaint(PaintEventArgs e)
int y_base = e.ClipRectangle.Height;
Rectangle rec = e.ClipRectangle;
rec.Height = (int)(y_base - (rec.Height * ((double)Value / Maximum)));
if (ProgressBarRenderer.IsSupported)
ProgressBarRenderer.DrawHorizontalBar(e.Graphics, e.ClipRectangle);
rec.Width = rec.Width - 4;
e.Graphics.FillRectangle(brush, 2, rec.Height, rec.Width, y_base);