HeaderPane
Main
Hide
Share Link
Print

Ticks and Labels

Ticks mark values along the track. By default a tick is shown at every SftSlider.TickFrequency values from SftSlider.Minimum, and at SftSlider.Maximum; SftSlider.CustomTicks places them at values of the application's own choosing instead. Labels show the values of the ticks.

MemberDescription
SftSlider.TickStyleWhere the ticks are shown: TickStyle.BottomRight (the default) below a horizontal slider and right of a vertical one, TickStyle.TopLeft above or left of it, TickStyle.Both on both sides, TickStyle.None without ticks.
SftSlider.TickFrequencyThe distance between ticks, in values (1 by default), 1 or more. The ticks at SftSlider.Minimum and SftSlider.Maximum are longer. When the distance would give more than 2000 ticks, only the ticks at SftSlider.Minimum and SftSlider.Maximum are shown, and SnapToTicks stops only there.
SftSlider.CustomTicksThe values at which ticks are shown, instead of ticks at a regular distance. Values outside SftSlider.Minimum and SftSlider.Maximum are ignored. An empty array (the default) uses TickFrequency.
SftSlider.ShowTickLabelsShows the value of each tick as a label beside the ticks (False by default). With TickStyle.TopLeft the labels are above or left of the ticks, otherwise below or right of them. Labels need ticks: with TickStyle.None they are not shown. A label is drawn at every tick, so choose a TickFrequency or CustomTicks that leave room for the labels.
SftSlider.TickLabelFormatA .NET numeric format string for the labels and the value tip, such as "N0", "C0" or "0'%'", formatted in the current culture. Empty (the default) shows the plain number.
SftSlider.SnapToTicksA dragged thumb stops only at ticks (False by default).
SftSlider.InvertedPuts the minimum at the right of a horizontal slider and at the top of a vertical one (False by default).

C#

sliderVolume.Maximum = 100;
sliderVolume.CustomTicks = new int[] { 0, 25, 50, 75, 100 };
sliderVolume.ShowTickLabels = true;
sliderVolume.TickLabelFormat = "0'%'";
sliderVolume.SnapToTicks = true;

VB

SliderVolume.Maximum = 100
SliderVolume.CustomTicks = New Integer() {0, 25, 50, 75, 100}
SliderVolume.ShowTickLabels = True
SliderVolume.TickLabelFormat = "0'%'"
SliderVolume.SnapToTicks = True

Snapping

With SftSlider.SnapToTicks, a thumb dragged with the mouse stops at the tick nearest to the mouse. Dragging the band of a range slider moves both thumbs by whole tick distances. The keyboard, the mouse wheel and a click on the track still change the value by SftSlider.SmallChange and SftSlider.LargeChange; set them to the distance between ticks to keep those at ticks as well.

Direction

A horizontal slider runs from left to right and a vertical one from bottom to top. SftSlider.Inverted reverses this. In a right-to-left layout (RightToLeft set to RightToLeft.Yes), a horizontal slider runs from right to left, and an inverted one from left to right. On a horizontal slider the Left and Right keys move a thumb in the direction of the arrow on the screen, and Up increases the value and Down decreases it. On a vertical slider Up and Down move a thumb in the direction of the arrow, Right moves it up and Left down.