Show / Hide Table of Contents

Class ProgressBar

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

Inheritance
object
ControlBase
ProgressBar
Inherited Members
ControlBase.MouseState_IsMouseOver
ControlBase.MouseState_EnteredWithButtonDown
ControlBase.MouseState_IsMouseLeftDown
ControlBase.MouseState_IsMouseRightDown
ControlBase.OnUnfocused()
ControlBase.OnFocused()
ControlBase.OnIsDirtyChanged()
ControlBase.ProcessMouse(MouseScreenObjectState)
ControlBase.LostMouse(MouseScreenObjectState)
ControlBase.OnParentChanged()
ControlBase.OnPositionChanged()
ControlBase.PlaceRelativeTo(ControlBase, Direction.Types, int)
ControlBase.DetermineState()
ControlBase.OnStateChanged(ControlStates, ControlStates)
ControlBase.OnSurfaceChanged(ICellSurface, ICellSurface)
ControlBase.FindThemeFont()
ControlBase.FindThemeColors()
ControlBase.SetThemeColors(Colors)
ControlBase.HasThemeColors()
ControlBase.Resize(int, int)
ControlBase.OnResized()
ControlBase.CreateControlSurface()
ControlBase.OnMouseEnter(ControlBase.ControlMouseState)
ControlBase.OnMouseExit(ControlBase.ControlMouseState)
ControlBase.OnMouseIn(ControlBase.ControlMouseState)
ControlBase.OnLeftMouseClicked(ControlBase.ControlMouseState)
ControlBase.OnRightMouseClicked(ControlBase.ControlMouseState)
ControlBase.ThemeState
ControlBase.UseKeyboard
ControlBase.UseMouse
ControlBase.CanFocus
ControlBase.CanResize
ControlBase.AlternateFont
ControlBase.Surface
ControlBase.MouseArea
ControlBase.IsMouseButtonStateClean
ControlBase.Position
ControlBase.AbsolutePosition
ControlBase.IsVisible
ControlBase.Tag
ControlBase.TabStop
ControlBase.TabIndex
ControlBase.IsDirty
ControlBase.Name
ControlBase.FocusOnMouseClick
ControlBase.Width
ControlBase.Height
ControlBase.IsFocused
ControlBase.IsEnabled
ControlBase.Bounds
ControlBase.Parent
ControlBase.State
ControlBase.IsDirtyChanged
ControlBase.Focused
ControlBase.Unfocused
ControlBase.PositionChanged
ControlBase.MouseEnter
ControlBase.MouseExit
ControlBase.MouseMove
ControlBase.MouseButtonClicked
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: SadConsole.UI.Controls
Assembly: SadConsole.dll
Syntax
[DataContract]
public class ProgressBar : ControlBase

Constructors

ProgressBar(int, int, HorizontalAlignment)

Creates a new horizontal progress bar.

Declaration
public ProgressBar(int width, int height, HorizontalAlignment horizontalAlignment)
Parameters
Type Name Description
int width

Width of the control.

int height

Height of the control.

HorizontalAlignment horizontalAlignment

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

Exceptions
Type Condition
InvalidOperationException

Thrown when horizontalAlignment is set to either Center or Stretch.

ProgressBar(int, int, VerticalAlignment)

Creates a new vertical progress bar.

Declaration
public ProgressBar(int width, int height, VerticalAlignment verticalAlignment)
Parameters
Type Name Description
int width

Width of the control.

int height

Height of the control.

VerticalAlignment verticalAlignment

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

Exceptions
Type Condition
InvalidOperationException

Thrown when verticalAlignment is set to either Center or Stretch.

Fields

controlSize

The size of the bar.

Declaration
[DataMember]
protected int controlSize
Field Value
Type Description
int

fillSize

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

Declaration
[DataMember]
public int fillSize
Field Value
Type Description
int

horizontalAlignment

The alignment if the bar is horizontal.

Declaration
[DataMember]
protected HorizontalAlignment horizontalAlignment
Field Value
Type Description
HorizontalAlignment

isHorizontal

Flag to indicate this bar was created horizontal.

Declaration
[DataMember]
protected bool isHorizontal
Field Value
Type Description
bool

progressValue

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

Declaration
[DataMember]
protected float progressValue
Field Value
Type Description
float

verticalAlignment

The alignment if the bar is vertical.

Declaration
[DataMember]
protected VerticalAlignment verticalAlignment
Field Value
Type Description
VerticalAlignment

Properties

BackgroundGlyph

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

Declaration
[DataMember]
public int BackgroundGlyph { get; set; }
Property Value
Type Description
int

BarColor

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

Declaration
[DataMember]
public Color? BarColor { get; set; }
Property Value
Type Description
Color?

BarGlyph

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

Declaration
[DataMember]
public int BarGlyph { get; set; }
Property Value
Type Description
int

DisplayText

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

Declaration
[DataMember]
public string DisplayText { get; set; }
Property Value
Type Description
string

DisplayTextAlignment

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

Declaration
[DataMember]
public HorizontalAlignment DisplayTextAlignment { get; set; }
Property Value
Type Description
HorizontalAlignment

DisplayTextColor

The color to print the DisplayText string.

Declaration
[DataMember]
public Color? DisplayTextColor { get; set; }
Property Value
Type Description
Color?

DisplayTextStates

The theme of the text displayed on the bar.

Declaration
[DataMember]
public ThemeStates DisplayTextStates { get; protected set; }
Property Value
Type Description
ThemeStates

HorizontalAlignment

The horizontal orientation used when IsHorizontal is set to true.

Declaration
public HorizontalAlignment HorizontalAlignment { get; set; }
Property Value
Type Description
HorizontalAlignment
Exceptions
Type Condition
InvalidOperationException

Thrown when the value is set to either Center or Stretch.

IsHorizontal

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

Declaration
public bool IsHorizontal { get; set; }
Property Value
Type Description
bool

PrintDisplayAsDecorator

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

Declaration
[DataMember]
public bool PrintDisplayAsDecorator { get; set; }
Property Value
Type Description
bool

Progress

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

Declaration
public float Progress { get; set; }
Property Value
Type Description
float

ThemeStateBar

The theme of the progressed part of the bar.

Declaration
[DataMember]
public ThemeStates ThemeStateBar { get; protected set; }
Property Value
Type Description
ThemeStates

VerticalAlignment

The vertical orientation used when IsHorizontal is set to false.

Declaration
public VerticalAlignment VerticalAlignment { get; set; }
Property Value
Type Description
VerticalAlignment
Exceptions
Type Condition
InvalidOperationException

Thrown when the value is set to either Center or Stretch.

Methods

ProcessKeyboard(Keyboard)

Called when the control should process keyboard information.

Declaration
public override bool ProcessKeyboard(Keyboard info)
Parameters
Type Name Description
Keyboard info

The keyboard information.

Returns
Type Description
bool

True if the keyboard was handled by this control.

Overrides
ControlBase.ProcessKeyboard(Keyboard)

RefreshThemeStateColors(Colors)

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

Declaration
protected override void RefreshThemeStateColors(Colors colors)
Parameters
Type Name Description
Colors colors

The colors to apply to the theme state.

Overrides
ControlBase.RefreshThemeStateColors(Colors)

UpdateAndRedraw(TimeSpan)

Redraws the control if applicable.

Declaration
public override void UpdateAndRedraw(TimeSpan time)
Parameters
Type Name Description
TimeSpan time

The duration of thecurrent frame.

Overrides
ControlBase.UpdateAndRedraw(TimeSpan)

Events

ProgressChanged

Called when the Progress property value changes.

Declaration
public event EventHandler? ProgressChanged
Event Type
Type Description
EventHandler

Extension Methods

ExtensionsSystem.GetDebuggerDisplayValue(object)
In this article

Back to top

Back to top Generated by DocFX