New to Telerik UI for WinForms? Download free 30-day trial

ProgressBarPrimitive

ProgressBarPrimitive is a specialized descendant of the FillPrimitive that indicates the state of progress in a long running process. The fill area is controlled by the GradientStyle and the BackColor.BackColor4 properties. The fill covers the percentage area between Minimum and Maximum specified by the Value1 property. Value1 is rendered using up to all four colors. Value2 displays in the BackColor at 25% opacity. Orientation controls the starting point of the fill and can originate from Left, Right, Top or Bottom. The example below shows a Linear fill for Value1(set to 20), and a pale Aqua for Value2(set to 70).

tpf-primitives-progressprimitive 001

Creating a ProgressBarPrimitive

public class MyProgressBarPrimitiveElement : RadElement
{
    protected override void CreateChildElements()
    {
        BorderPrimitive borderPrimitive = new BorderPrimitive();
        borderPrimitive.BoxStyle = BorderBoxStyle.OuterInnerBorders;
        borderPrimitive.GradientStyle = GradientStyles.Solid;
        borderPrimitive.ForeColor = Color.Blue;
        borderPrimitive.InnerColor = Color.LightSkyBlue;  
        ProgressBarPrimitive progressBarPrimitive = new ProgressBarPrimitive();
        progressBarPrimitive.GradientStyle = GradientStyles.Linear;
        progressBarPrimitive.NumberOfColors = 4;
        progressBarPrimitive.Orientation = ProgressOrientation.Left;
        progressBarPrimitive.Value1 = 20;
        progressBarPrimitive.Value2 = 70;
        progressBarPrimitive.Minimum = 1;
        progressBarPrimitive.Maximum = 100;
        progressBarPrimitive.BackColor = Color.Aqua;
        progressBarPrimitive.BackColor2 = Color.Blue;
        progressBarPrimitive.BackColor3 = Color.SkyBlue;
        progressBarPrimitive.BackColor4 = Color.LightSkyBlue;
        borderPrimitive.ZIndex = 1;
        this.Children.Add(borderPrimitive);
        this.Children.Add(progressBarPrimitive);
        base.CreateChildElements();
    }
}

Public Class MyProgressBarPrimitiveElement
    Inherits RadElement
    Protected Overrides Sub CreateChildElements()
        Dim borderPrimitive As New BorderPrimitive()
        borderPrimitive.BoxStyle = BorderBoxStyle.OuterInnerBorders
        borderPrimitive.GradientStyle = GradientStyles.Solid
        borderPrimitive.ForeColor = Color.Blue
        borderPrimitive.InnerColor = Color.LightSkyBlue
        Dim progressBarPrimitive As New ProgressBarPrimitive()
        progressBarPrimitive.GradientStyle = GradientStyles.Linear
        progressBarPrimitive.NumberOfColors = 4
        progressBarPrimitive.Orientation = ProgressOrientation.Left
        progressBarPrimitive.Value1 = 20
        progressBarPrimitive.Value2 = 70
        progressBarPrimitive.Minimum = 1
        progressBarPrimitive.Maximum = 100
        progressBarPrimitive.BackColor = Color.Aqua
        progressBarPrimitive.BackColor2 = Color.Blue
        progressBarPrimitive.BackColor3 = Color.SkyBlue
        progressBarPrimitive.BackColor4 = Color.LightSkyBlue
        borderPrimitive.ZIndex = 1
        Me.Children.Add(borderPrimitive)
        Me.Children.Add(progressBarPrimitive)
        MyBase.CreateChildElements()
    End Sub
End Class

See Also

In this article