Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make a winforms progress bar move vertically in C#?

I'm working on a WinForms Jukebox.
I'd like to have a vertical ProgressBar for the volume control.

Does anyone know how to do that?

like image 400
Krakerjak Avatar asked Feb 28 '09 02:02

Krakerjak


People also ask

How do I use the ProgressBar in Winforms?

Step = 1; progressBar1. Value = 0; backgroundWorker. RunWorkerAsync(); } private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) { var backgroundWorker = sender as BackgroundWorker; for (int j = 0; j < 100000; j++) { Calculate(j); backgroundWorker.

How do I create a ProgressBar in Visual Studio?

Create a custom ProgressBar controlStart Microsoft Visual Studio. On the File menu, point to New, and then click Project. In the New Project dialog box, click Visual C# under Project Types, and then click Windows Forms Control Library under Templates. In the Name box, type SmoothProgressBar, and then click OK.


1 Answers

I don't know that I'd use a progress bar to control the volume, but to display the volume level you could use a user drawn control or you could just resize a label with a background color (that last method is kind of kludgy though)

The progress bar isn't meant to take input, no matter what the orientation.

If you really would like to control the volume, consider using a vertical scroll bar, or a trackbar with a vertical orientation.

For what it's worth, there's a discussion on how to create a vertical progress bar on MSDN, where they suggest doing this:

using System; 
using System.Windows.Forms; 

public class VerticalProgressBar : ProgressBar { 
  protected override CreateParams CreateParams { 
    get { 
      CreateParams cp = base.CreateParams; 
      cp.Style |= 0x04; 
      return cp; 
    } 
  } 
}

which sets the PBS_VERTICAL flag in Style.

like image 137
Daniel LeCheminant Avatar answered Oct 11 '22 16:10

Daniel LeCheminant