Skip to content

ProgressBar Class

A control that fills an area (vertical or horizontal) according to a value.

C#
[DataContract]
public class ProgressBar : ControlBase

Inheritance objectControlBase

ProgressBar(int, int, HorizontalAlignment)

Section titled “ProgressBar(int, int, HorizontalAlignment)”

Creates a new horizontal progress bar.

C#
public ProgressBar(int width, int height, HorizontalAlignment horizontalAlignment)

width int
Width of the control.

height int
Height of the control.

horizontalAlignment HorizontalAlignment
Sets the control to be horizontal, starting from the specified side. Center/Stretch is invalid.

InvalidOperationException
Thrown when horizontalAlignment is set to either Center or Stretch.

Creates a new vertical progress bar.

C#
public ProgressBar(int width, int height, VerticalAlignment verticalAlignment)

width int
Width of the control.

height int
Height of the control.

verticalAlignment VerticalAlignment
Sets the control to be vertical, starting from the specified side. Center/Stretch is invalid.

InvalidOperationException
Thrown when verticalAlignment is set to either Center or Stretch.

The progress bar fill value. Between 0f and 1f.

C#
[DataMember]
protected float progressValue

The size of the bar.

C#
[DataMember]
protected int controlSize

For theme use only. The size of the bar currently filled based on the Progress property.

C#
[DataMember]
public int fillSize

Flag to indicate this bar was created horizontal.

C#
[DataMember]
protected bool isHorizontal

The alignment if the bar is horizontal.

C#
[DataMember]
protected HorizontalAlignment horizontalAlignment

The alignment if the bar is vertical.

C#
[DataMember]
protected VerticalAlignment verticalAlignment

An optional text to display on the bar. If set to "%", displays the percentage of the progress.

C#
[DataMember]
public string DisplayText { get; set; }

Alignment to print the DisplayText. Stretch is invalid for the property.

C#
[DataMember]
public HorizontalAlignment DisplayTextAlignment { get; set; }

The horizontal orientation used when IsHorizontal is set to true.

C#
public HorizontalAlignment HorizontalAlignment { get; set; }

The vertical orientation used when IsHorizontal is set to false.

C#
public VerticalAlignment VerticalAlignment { get; set; }

When true, the progress bar uses the HorizontalAlignment property to determine the starting fill direction. When false, uses the VerticalAlignment property.

C#
public bool IsHorizontal { get; set; }

Gets or sets the value of the scrollbar between 0.0 and 1.0.

C#
public float Progress { get; set; }

The theme of the progressed part of the bar.

C#
[DataMember]
public ThemeStates ThemeStateBar { get; protected set; }

The theme of the text displayed on the bar.

C#
[DataMember]
public ThemeStates DisplayTextStates { get; protected set; }

The glyph to use when drawing the unfilled part of the bar.

C#
[DataMember]
public int BackgroundGlyph { get; set; }

The glyph to use when drawing the filled part of the bar.

C#
[DataMember]
public int BarGlyph { get; set; }

The color to print the DisplayText string.

C#
[DataMember]
public Color? DisplayTextColor { get; set; }

The color to print the filled part of the progress bar.

C#
[DataMember]
public Color? BarColor { get; set; }

When true, prints the DisplayText on the control in decorators instead of replacing the portation of the bar that overlaps the text.

C#
[DataMember]
public bool PrintDisplayAsDecorator { get; set; }

Called when the control should process keyboard information.

C#
public override bool ProcessKeyboard(Keyboard info)

info Keyboard
The keyboard information.

bool
True if the keyboard was handled by this control.

Updates the ThemeState by calling RefreshTheme(Colors) with the provided colors. Override this method to adjust how colors are used by the ThemeState.

C#
protected override void RefreshThemeStateColors(Colors colors)

colors Colors
The colors to apply to the theme state.

Redraws the control if applicable.

C#
public override void UpdateAndRedraw(TimeSpan time)

time TimeSpan
The duration of thecurrent frame.

Called when the Progress property value changes.

C#
public event EventHandler? ProgressChanged

EventHandler