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

TrackBarPrimitive

TrackBarPrimitive provides the basic visual layout of a trackbar background. Typically you would use a higher level object, i.e. the RadTrackBarElement to include in your control. RadTrackBarElement handles the position of the track bar thumb and the various events that go into making the track bar useful.

tpf-primitives-trackbarprimitive 001

Creating a TrackBarPrimitive

public class MyTrackBarPrimitiveElement : RadElement
{
    protected override void CreateChildElements()
    {        
        TrackBarPrimitive trackBarPrimitive = new TrackBarPrimitive();
        trackBarPrimitive.ForeColor = Color.Blue;
        trackBarPrimitive.BackColor = Color.SkyBlue;
        trackBarPrimitive.TickColor = Color.Green;
        trackBarPrimitive.ThumbWidth = 5;
        trackBarPrimitive.ShowSlideArea = true;
        trackBarPrimitive.TickStyle = Telerik.WinControls.Enumerations.TickStyles.Both;
        trackBarPrimitive.TrackBarOrientation = Orientation.Horizontal;
        this.Children.Add(trackBarPrimitive);
        base.CreateChildElements();
    }
}

Public Class MyTrackBarPrimitiveElement
    Inherits RadElement
    Protected Overrides Sub CreateChildElements()
        Dim trackBarPrimitive As New TrackBarPrimitive()
        trackBarPrimitive.ForeColor = Color.Blue
        trackBarPrimitive.BackColor = Color.SkyBlue
        trackBarPrimitive.TickColor = Color.Green
        trackBarPrimitive.ThumbWidth = 5
        trackBarPrimitive.ShowSlideArea = True
        trackBarPrimitive.TickStyle = Telerik.WinControls.Enumerations.TickStyles.Both
        trackBarPrimitive.TrackBarOrientation = Orientation.Horizontal
        Me.Children.Add(trackBarPrimitive)
        MyBase.CreateChildElements()
    End Sub
End Class

See Also

In this article