ProgressBar
The ProgressBar widget displays a visual progress indicator with optional percentage text.
Overview
Section titled “Overview”ProgressBar shows progress using filled and unfilled portions, with customizable colors and optional percentage display.
Properties
Section titled “Properties”Value (double)
Section titled “Value (double)”The current progress value. Must be between Minimum and Maximum.
progressBar.Value = 50;Minimum (double)
Section titled “Minimum (double)”The minimum value (default: 0).
progressBar.Minimum = 0;Maximum (double)
Section titled “Maximum (double)”The maximum value (default: 100).
progressBar.Maximum = 100;ShowPercentage (bool)
Section titled “ShowPercentage (bool)”Whether to display percentage text on the progress bar.
progressBar.ShowPercentage = true;FilledColor (Color)
Section titled “FilledColor (Color)”Color of the filled portion.
progressBar.FilledColor = Color.Green;UnfilledColor (Color)
Section titled “UnfilledColor (Color)”Color of the unfilled portion.
progressBar.UnfilledColor = Color.DarkGray;FilledTextColor (Color)
Section titled “FilledTextColor (Color)”Text color for percentage when displayed over filled portion.
progressBar.FilledTextColor = Color.White;PercentageVerticalAlignment (VerticalAlignment)
Section titled “PercentageVerticalAlignment (VerticalAlignment)”Vertical alignment of percentage text.
progressBar.PercentageVerticalAlignment = VerticalAlignment.Middle;PercentageHorizontalAlignment (HorizontalAlignment)
Section titled “PercentageHorizontalAlignment (HorizontalAlignment)”Horizontal alignment of percentage text.
progressBar.PercentageHorizontalAlignment = HorizontalAlignment.Center;Methods
Section titled “Methods”Increment(double amount = 1)
Section titled “Increment(double amount = 1)”Increments the value by the specified amount.
progressBar.Increment(5);Decrement(double amount = 1)
Section titled “Decrement(double amount = 1)”Decrements the value by the specified amount.
progressBar.Decrement(5);SetPercentage(double percentage)
Section titled “SetPercentage(double percentage)”Sets the value to a specific percentage (0-100).
progressBar.SetPercentage(75); // Sets to 75%Properties
Section titled “Properties”Percentage (double, read-only)
Section titled “Percentage (double, read-only)”Gets the current progress as a percentage (0-100).
double percent = progressBar.Percentage;Events
Section titled “Events”ValueChanged
Section titled “ValueChanged”Raised when the value changes.
progressBar.ValueChanged += (value) =>{ Console.WriteLine($"Progress: {value}");};Usage Example
Section titled “Usage Example”var progressBar = new ProgressBar{ X = 10, Y = 5, Width = 50, Height = 1, Value = 42, ShowPercentage = true, FilledColor = ColorHelper.FromRgb(100, 200, 100), UnfilledColor = ColorHelper.FromRgb(50, 50, 50), FilledTextColor = Color.White};
// Update progressprogressBar.Value = 75;progressBar.Increment(10);progressBar.SetPercentage(90);Related Widgets
Section titled “Related Widgets”- Label - For displaying text labels
- Base Widget - Base class documentation