Class ProgressBarAdv
ProgressBarAdv is an extension to the standard progress bar with many styles to choose from.
Inherited Members
Namespace: Syncfusion.Windows.Forms.Tools
Assembly: Syncfusion.Shared.Base.dll
Syntax
public class ProgressBarAdv : ThemedControl, IDisposable, ISupportInitialize, IThemeProvider, IVisualStyle
Remarks
The ProgressBarAdv control has background, border and foreground styles. The background styles are ProgressBarBackgroundStyles. The border styles are BorderStyle. The foreground styles are ProgressBarStyles.
this.progressBarEx1 = new ProgressBarAdv();
this.progressBarEx1.BackGradientEndColor = System.Drawing.SystemColors.ControlLightLight;
this.progressBarEx1.BackGradientStartColor = System.Drawing.SystemColors.ControlDark;
this.progressBarEx1.BackgroundStyle = ProgressBarBackgroundStyles.VerticalGradient;
this.progressBarEx1.BackSegments = false;
this.progressBarEx1.Border3DStyle = System.Windows.Forms.Border3DStyle.RaisedOuter;
this.progressBarEx1.FontColor = System.Drawing.SystemColors.HighlightText;
this.progressBarEx1.Location = new System.Drawing.Point(240, 8);
this.progressBarEx1.ProgressStyle = ProgressBarStyles.Tube;
this.progressBarEx1.SegmentWidth = 20;
this.progressBarEx1.Size = new System.Drawing.Size(400, 23);
this.progressBarEx1.TextShadow = false;
this.progressBarEx1.ThemesEnabled = false;
this.progressBarEx1.TubeEndColor = System.Drawing.SystemColors.Control;
this.progressBarEx1.TubeStartColor = System.Drawing.SystemColors.ControlDark;
this.progressBarEx1.Value = 79;
Constructors
ProgressBarAdv()
Constructor.
Declaration
public ProgressBarAdv()
Fields
prev_borderColor
Declaration
protected Color prev_borderColor
Field Value
Type |
---|
System.Drawing.Color |
prev_borderStyle
Declaration
protected BorderStyle prev_borderStyle
Field Value
Type |
---|
System.Windows.Forms.BorderStyle |
prev_foreEndColor
Declaration
protected Color prev_foreEndColor
Field Value
Type |
---|
System.Drawing.Color |
prev_foreStartColor
Declaration
protected Color prev_foreStartColor
Field Value
Type |
---|
System.Drawing.Color |
Properties
BackGradientEndColor
Gets / sets the end color of the background gradient when BackgroundStyle is gradient or vertical gradient.
Declaration
public Color BackGradientEndColor { get; set; }
Property Value
Type |
---|
System.Drawing.Color |
BackGradientStartColor
Gets / sets the start color of the background gradient when BackgroundStyle is gradient or vertical gradient.
Declaration
public Color BackGradientStartColor { get; set; }
Property Value
Type |
---|
System.Drawing.Color |
BackgroundFallbackStyle
Gets / sets the style of the background when BackgroundStyle is set to System and the system cannot support themes.
Declaration
public ProgressBarBackgroundStyles BackgroundFallbackStyle { get; set; }
Property Value
Type |
---|
ProgressBarBackgroundStyles |
Remarks
By default, its value is None.
BackgroundStyle
Gets / sets the style of the background. It can have the following values: -Office2016Colorful -Office2016Black -Office2016White -Office2016DarkGray -Image -Gradient -Vertical gradient -Tube -Multiple gradient -System -None
Declaration
public ProgressBarBackgroundStyles BackgroundStyle { get; set; }
Property Value
Type |
---|
ProgressBarBackgroundStyles |
Remarks
By default, its value is None.
BackMultipleColors
Gets / sets the colors of the background multiple gradients when BackgroundStyle is multiple gradient.
Declaration
public Color[] BackMultipleColors { get; set; }
Property Value
Type |
---|
System.Drawing.Color[] |
Remarks
By default, its value is an empty array of colors.
BackSegments
Indicates whether the background is segmented.
Declaration
public bool BackSegments { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
By default, its value is False.
BackTubeEndColor
Gets / sets the end color of the background tube when BackgroundStyle is Tube.
Declaration
public Color BackTubeEndColor { get; set; }
Property Value
Type |
---|
System.Drawing.Color |
BackTubeStartColor
Gets / sets the start color of the background tube when BackgroundStyle is Tube.
Declaration
public Color BackTubeStartColor { get; set; }
Property Value
Type |
---|
System.Drawing.Color |
Border3DStyle
Gets / sets the style of the border when BorderStyle is Fixed3D.
Declaration
public Border3DStyle Border3DStyle { get; set; }
Property Value
Type |
---|
System.Windows.Forms.Border3DStyle |
Remarks
By default, its value is Sunken.
BorderColor
Gets / sets the color of the border when BorderStyles is FixedSingle.
Declaration
public Color BorderColor { get; set; }
Property Value
Type |
---|
System.Drawing.Color |
BorderSingle
Gets / sets the style of the border when BorderStyles is FixedSingle.
Declaration
public ButtonBorderStyle BorderSingle { get; set; }
Property Value
Type |
---|
System.Windows.Forms.ButtonBorderStyle |
Remarks
By default, its value is Solid.
BorderStyle
Gets / sets the style of the border. It can be None, 3D or 2D.
Declaration
public BorderStyle BorderStyle { get; set; }
Property Value
Type |
---|
System.Windows.Forms.BorderStyle |
Remarks
By default, its value is Fixed3D.
CanApplyTheme
Gets or sets a value indicating whether a SkinManager theme style has been applied to the control.
Declaration
public bool CanApplyTheme { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The default value is true. |
CanOverrideStyle
Gets or sets a value indicating whether control elements styles can be overridden by theme style settings.
Declaration
public bool CanOverrideStyle { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Default value is false. |
Remarks
By default, the control's element styles will not be overridden by theme style settings if the style is set in sample level. If this property is enabled, element style will be overridden by theme style settings event if it is set in sample level. This property should be enabled or disabled before calling the ThemeName property of the control.
CustomText
Gets or sets the custom text for the ProgressBarAdv.
Declaration
public string CustomText { get; set; }
Property Value
Type | Description |
---|---|
System.String | The custom text. |
Remarks
This value represents the CustomText of the ProgessBarAdv. The customText is returned only if we set the ProgressBarTextStyles.Custom
CustomWaitingRender
Indicates whether the waiting gradient will be replaced by another custom waiting render which is defaulted to segments. To customize it, handle the DrawCustomWaitingRender event.
Declaration
public bool CustomWaitingRender { get; set; }
Property Value
Type |
---|
System.Boolean |
Font
Gets or sets System.Drawing.Font used to draw the progress value of the ProgressBarAdv control.
Declaration
public override Font Font { get; set; }
Property Value
Type |
---|
System.Drawing.Font |
FontColor
Gets / sets the color of the font.
Declaration
public Color FontColor { get; set; }
Property Value
Type |
---|
System.Drawing.Color |
ForeColor
Gets / sets the color used to draw the foreground in segment mode and constant mode.
Declaration
public override Color ForeColor { get; set; }
Property Value
Type |
---|
System.Drawing.Color |
ForegroundImage
Gets / sets the image to draw on the foreground when ProgressStyle is Image.
Declaration
public Image ForegroundImage { get; set; }
Property Value
Type |
---|
System.Drawing.Image |
ForeSegments
Indicates whether the foreground is segmented.
Declaration
public bool ForeSegments { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
By default, its value is True which means that the foreground will be drawn segmented.
GradientEndColor
Gets / sets the end color of the foreground gradient when ForegroundStyle is gradient.
Declaration
public Color GradientEndColor { get; set; }
Property Value
Type |
---|
System.Drawing.Color |
GradientStartColor
Gets / sets the start color of the foreground gradient when ForegroundStyle is gradient.
Declaration
public Color GradientStartColor { get; set; }
Property Value
Type |
---|
System.Drawing.Color |
IsVisualStyleEnabled
Gets a value indicating whether the visual style based theme is applied to the control and also indicates whether the theme files are referred from external assemblies or not.
Declaration
public bool IsVisualStyleEnabled { get; }
Property Value
Type | Description |
---|---|
System.Boolean | Return true, if the visual style based theme is applied to the control. Otherwise returns false. |
Maximum
Gets / sets the upper boundary for the value.
Declaration
public int Maximum { get; set; }
Property Value
Type |
---|
System.Int32 |
Remarks
By default, its value is 100 which means that the value of the ProgressBar cannot take values higher than 100.
Minimum
Gets / sets the lower boundary for the value.
Declaration
public int Minimum { get; set; }
Property Value
Type |
---|
System.Int32 |
Remarks
By default, its value is zero which means that the value of the ProgressBar cannot take values lower than zero.
MultipleColors
Gets / sets the colors of the foreground multiple gradient when ForegroundStyle is multiple gradient.
Declaration
public Color[] MultipleColors { get; set; }
Property Value
Type |
---|
System.Drawing.Color[] |
Remarks
By default, its value is an empty color array. You can add colors to multiple gradients by modifying this property.
ProgressFallbackStyle
Gets / sets the style of the foreground when ProgressStyle is System and the system can not support themes.
Declaration
public ProgressBarStyles ProgressFallbackStyle { get; set; }
Property Value
Type |
---|
ProgressBarStyles |
ProgressImage
Gets / sets the marker image to draw on right side of the Progress.
Declaration
public Image ProgressImage { get; set; }
Property Value
Type |
---|
System.Drawing.Image |
ProgressImageSize
Gets / sets the marker image size to draw on right side of the Progress.
Declaration
public Size ProgressImageSize { get; set; }
Property Value
Type |
---|
System.Drawing.Size |
ProgressOrientation
Gets / sets the horizontal or vertical style of the progress bar.
Declaration
public Orientation ProgressOrientation { get; set; }
Property Value
Type |
---|
System.Windows.Forms.Orientation |
Remarks
By default, its value is Horizontal.
ProgressStyle
Gets / sets the style of the foreground: -Constant -Gradient -Multiple gradient -Tube -Image -System -Office2016Colorful -Office2016Black -Office2016White -Office2016DarkGray
Declaration
public ProgressBarStyles ProgressStyle { get; set; }
Property Value
Type |
---|
ProgressBarStyles |
Remarks
By default, its value is constant.
Renderer
Gets/Sets the Renderer of the ProgressBarAdv.
Declaration
public IProgressBarAdvRenderer Renderer { get; set; }
Property Value
Type |
---|
IProgressBarAdvRenderer |
SegmentWidth
Gets / sets the width of the segments.
Declaration
public int SegmentWidth { get; set; }
Property Value
Type |
---|
System.Int32 |
Remarks
By default, its value is 12.
ShowProgressImage
Gets or sets whether the Marker image is shows on ProgressBar.
Declaration
public bool ShowProgressImage { get; set; }
Property Value
Type |
---|
System.Boolean |
Step
Gets / sets the value to increment when Increment() and Decrement() methods.
Declaration
public int Step { get; set; }
Property Value
Type |
---|
System.Int32 |
Remarks
By default, its value is 10 which means that when Increment() is called, the value of the ProgressBar is incremented by 10.
StretchImage
Indicates whether the foreground image will be stretched.
Declaration
public bool StretchImage { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
By default, its value is True.
StretchMultGrad
Indicates whether the multiple gradient is compressed if the value is smaller than the maximum.
Declaration
public bool StretchMultGrad { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
By default, its value is True which means that if the value is less than the maximum, the multiple gradient is compressed.
TextAlignment
Gets / sets the text alignment of the ProgressBarAdv.
Declaration
public TextAlignment TextAlignment { get; set; }
Property Value
Type |
---|
TextAlignment |
TextOrientation
Gets / sets the orientation of the text.
Declaration
public Orientation TextOrientation { get; set; }
Property Value
Type |
---|
System.Windows.Forms.Orientation |
TextShadow
Indicates whether the text shadow is visible.
Declaration
public bool TextShadow { get; set; }
Property Value
Type |
---|
System.Boolean |
TextStyle
Gets / sets the style of the text: -Percentage -Value (Ex: 70/150 )
Declaration
public ProgressBarTextStyles TextStyle { get; set; }
Property Value
Type |
---|
ProgressBarTextStyles |
TextVisible
Indicates whether the text is visible.
Declaration
public bool TextVisible { get; set; }
Property Value
Type |
---|
System.Boolean |
ThemeName
Gets or sets the theme name of the ProgressBarAdv control.
Declaration
public string ThemeName { get; set; }
Property Value
Type |
---|
System.String |
ThemeStyle
Gets or sets the
Declaration
public ProgressBarAdvVisualStyle ThemeStyle { get; set; }
Property Value
Type |
---|
ProgressBarAdvVisualStyle |
TubeEndColor
Gets / sets the end color of the foreground tube when ForegroundStyle is Tube.
Declaration
public Color TubeEndColor { get; set; }
Property Value
Type |
---|
System.Drawing.Color |
TubeStartColor
Gets / sets the start color of the foreground tube when ForegroundStyle is Tube.
Declaration
public Color TubeStartColor { get; set; }
Property Value
Type |
---|
System.Drawing.Color |
Value
Gets / sets the value between minimum and maximum.
Declaration
public int Value { get; set; }
Property Value
Type |
---|
System.Int32 |
Remarks
This value represents the progress state of the ProgessBar. For default if it is set to 50, minimum=0 and maximum=100 ( 50% ).
WaitingGradientEnabled
Indicates whether the waiting gradient is enabled.
Declaration
public bool WaitingGradientEnabled { get; set; }
Property Value
Type |
---|
System.Boolean |
WaitingGradientInterval
Gets / sets the interval of the waiting gradient.
Declaration
public int WaitingGradientInterval { get; set; }
Property Value
Type |
---|
System.Int32 |
WaitingGradientWidth
Gets / sets the width of the waiting gradient.
Declaration
public int WaitingGradientWidth { get; set; }
Property Value
Type |
---|
System.Int32 |
Methods
BeginInit()
Starts initialization mode.
Declaration
public void BeginInit()
CreateAccessibilityInstance()
Declaration
protected override AccessibleObject CreateAccessibilityInstance()
Returns
Type |
---|
System.Windows.Forms.AccessibleObject |
Decrement()
Decrements the Value property with the Step value.
Declaration
public bool Decrement()
Returns
Type | Description |
---|---|
System.Boolean | The success or failure of the Increment. It fails if the incremented value is smaller than minimum. |
Dispose(Boolean)
Cleans up any resources being used.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
Draw(Graphics, Rectangle)
Draws the contents of the progress bar at the specified rectangle. This method can only be called when the control has no handle attached or is not visible.
Declaration
public void Draw(Graphics g, Rectangle rect)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The graphics context. |
System.Drawing.Rectangle | rect | The rectangle. |
Remarks
Essential Grid calls this method to render the contents of the progress bar within a cell's area.
No border will be drawn around the control.
The method will throw an InvalidOperationException if the control has a handle and is visible.
The method will reset the bounds and BorderStyle of this control.
note
This method only supports horizontal progress bars. We will add support for static drawing of vertical progress bars in the future.
Draw(Graphics, Rectangle, Boolean)
Draws the contents of the progress bar at the specified rectangle. This method can only be called when the control has no handle attached or is not visible.
Declaration
public void Draw(Graphics g, Rectangle clientRectangle, bool drawRightToLeft)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The graphics context. |
System.Drawing.Rectangle | clientRectangle | The rectangle. |
System.Boolean | drawRightToLeft | Specifies if the progressbar should be drawn right to left. |
Remarks
Essential Grid calls this method to render the contents of the progress bar within a cell's area.
No border will be drawn around the control.
The method will throw an InvalidOperationException if the control has a handle and is visible.
The method will reset bounds and BorderStyle of this control.
note
This method only support horizontal progress bars. We will add support for static drawing of vertical progress bars in the future.
EndInit()
Ends initialization mode and calls RefreshBrushes().
Declaration
public void EndInit()
EndInit(Boolean)
Implementation of the System.ComponentModel.ISupportInitialize interface.
Declaration
public void EndInit(bool refreshBrushes)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | refreshBrushes | Set this to False if you want to refresh brushes later. |
GetActiveThemeName()
Gets the active theme name of the ProgressBarAdv control.
Declaration
public string GetActiveThemeName()
Returns
Type | Description |
---|---|
System.String | Returns the active theme name. |
Increment()
Increments the Value property with the Step value.
Declaration
public bool Increment()
Returns
Type | Description |
---|---|
System.Boolean | The success or failure of the Increment. It fails if the incremented value is bigger than the maximum. |
OnDrawWaitingCustomRender(ProgressBarAdvDrawEventArgs)
Declaration
protected virtual void OnDrawWaitingCustomRender(ProgressBarAdvDrawEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
ProgressBarAdvDrawEventArgs | e |
OnFontChanged(EventArgs)
Font changed
Declaration
protected override void OnFontChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e |
OnHandleCreated(EventArgs)
Declaration
protected override void OnHandleCreated(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e |
OnValueChanged(ProgressBarValueChangedEventArgs)
Declaration
protected virtual void OnValueChanged(ProgressBarValueChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
ProgressBarValueChangedEventArgs | e |
RefreshBrushes()
Recreates the brushes used to draw the ProgressBar.
Declaration
public void RefreshBrushes()
ResetBorderColor()
Resets the bordercolor
Declaration
public void ResetBorderColor()
ResetBorderStyle()
Reset the border style
Declaration
public void ResetBorderStyle()
ResetGradientEndColor()
Resets the gradient color
Declaration
public void ResetGradientEndColor()
ResetGradientStartColor()
Resets the gradient color
Declaration
public void ResetGradientStartColor()
ResetProgressImage()
Resets the ProgressImage property to it's default value.
Declaration
public void ResetProgressImage()
ResetProgressImageSize()
Resets the ProgressImageSize property to it's default value.
Declaration
public void ResetProgressImageSize()
ResetShowProgressImage()
Resets the ShowProgressImage property to it's default value.
Declaration
public void ResetShowProgressImage()
ShouldSerializeBorderColor()
Serializes the bordercolor
Declaration
protected bool ShouldSerializeBorderColor()
Returns
Type |
---|
System.Boolean |
ShouldSerializeBorderStyle()
Serialize the borderstyle
Declaration
protected bool ShouldSerializeBorderStyle()
Returns
Type |
---|
System.Boolean |
ShouldSerializeGradientEndColor()
Serialize the gradient color
Declaration
protected bool ShouldSerializeGradientEndColor()
Returns
Type |
---|
System.Boolean |
ShouldSerializeGradientStartColor()
Serialize the gradient color
Declaration
protected bool ShouldSerializeGradientStartColor()
Returns
Type |
---|
System.Boolean |
ShouldSerializeProgressImage()
Indicates whether the current value of the ProgressImage property is to be serialized.
Declaration
protected bool ShouldSerializeProgressImage()
Returns
Type |
---|
System.Boolean |
ShouldSerializeProgressImageSize()
Indicates whether the current value of the ProgressImageSize property is to be serialized.
Declaration
protected bool ShouldSerializeProgressImageSize()
Returns
Type |
---|
System.Boolean |
ShouldSerializeShowProgressImage()
Indicates whether the current value of the ShowProgressImage property is to be serialized.
Declaration
protected bool ShouldSerializeShowProgressImage()
Returns
Type |
---|
System.Boolean |
Events
DrawWaitingCustomRender
Handle this event to draw a custom waiting render. WaitingCustomRender must be set to True.
Declaration
public event ProgressBarAdvDrawEventHandler DrawWaitingCustomRender
Event Type
Type |
---|
ProgressBarAdvDrawEventHandler |
ThemeNameChanged
Occurs when theme name of the ProgressBarAdv has changed.
Declaration
public event ThemeChangedEventHandler ThemeNameChanged
Event Type
Type |
---|
ThemeChangedEventHandler |
ValueChanged
Handle this event to set the text of the progressbar when the value changes. Make sure the TextStyle property is set to Custom.
Declaration
public event ProgressBarValueChangedEventHandler ValueChanged
Event Type
Type |
---|
ProgressBarValueChangedEventHandler |
Remarks
Explicit Interface Implementations
IVisualStyle.VisualTheme
Gets or sets the VisualTheme of the ProgressBarAdv control.
Declaration
string IVisualStyle.VisualTheme { get; set; }
Returns
Type |
---|
System.String |
IThemeProvider.BaseThemeName
Gets or sets the BaseTheme name of the theme
Declaration
string IThemeProvider.BaseThemeName { get; set; }
Returns
Type |
---|
System.String |
IThemeProvider.ControlName
Gets the name of the control.
Declaration
string IThemeProvider.ControlName { get; }
Returns
Type |
---|
System.String |