Skip to content

ProgressBar

Tyberious edited this page Aug 31, 2023 · 1 revision

ProgressBar Control

The ProgressBar control allows you to create a visual progress indicator in the console.

Properties

  • Value: Gets or sets the current value of the progress bar.
  • MaxValue: Sets the maximum value of the progress bar.
  • X and Y: Specify the coordinates for the position of the progress bar.
  • ForegroundColor and BackgroundColor: Set colors for the progress bar.
  • FillCharacter and EmptyCharacter: Customize the appearance of the bar.
  • BarWidth: Adjust the width of the progress bar.

Example

ProgressBar progressBar = new ProgressBar
{
    X = 10,
    Y = 5,
    MaxValue = 100,
    Value = 50,
    ForegroundColor = ConsoleColor.Green,
    BackgroundColor = ConsoleColor.DarkGray,
    BarWidth = 20
};

progressBar.Redraw();

The Redraw method is automatically run when the ProgressBar.Value property is changed

Clone this wiki locally