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

Scheduler Ruler

The ruler in RadScheduler is used to show the time intervals of the current view.

The ruler has various properties which can be used to modify its appearance. The examples below demonstrate the various behaviors of the ruler. The ruler can be accessed as follows:

RulerPrimitive ruler = (this.scheduler.SchedulerElement.ViewElement as SchedulerDayViewElement).DataAreaElement.Ruler;

Dim ruler As RulerPrimitive = TryCast(Me.scheduler.SchedulerElement.ViewElement, SchedulerDayViewElement).DataAreaElement.Ruler

Figure 1: RadScheduler Ruler

WinForms RadScheduler RadScheduler Ruler

  • TimePointerStyle - Sets the style of the pointer which shows the current time. Can be Arrow, Line or SimpleLine.
ruler.TimePointerStyle = RulerCurrentTimePointer.Arrow;

ruler.TimePointerStyle = RulerCurrentTimePointer.Arrow

Figure 2: Time Pointer Style

WinForms RadScheduler Time Pointer Style

  • Start and EndScale - Sets the time when the ruler starts and ends.
ruler.StartScale = 2;
ruler.EndScale = 9;

ruler.StartScale = 2
ruler.EndScale = 9

Figure 3: Start and End Scales

WinForms RadScheduler Start and End Scales

  • RangeFactor - The range factor determines whether the units in the ruler will be devided in FiveMinutes, HalfHour, Hour, QuarterHour, SixMinutes or TenMinutes.
ruler.RangeFactor = ScaleRange.FiveMinutes;

ruler.RangeFactor = ScaleRange.FiveMinutes

Figure 4: Ruler Range

WinForms RadScheduler Ruler Range

  • CurrentTimePointerWidth and CurrentTimePointerColor - Sets the size and the color of the pointer which shows the current time.
ruler.CurrentTimePointerWidth = 10;
ruler.CurrentTimePointerColor = Color.Red;

ruler.CurrentTimePointerWidth = 10
ruler.CurrentTimePointerColor = Color.Red

Figure 5: Time Pointer Width

WinForms RadScheduler Time Pointer Width

  • RulerFormatStrings and the RulerTextFormatting event - They are used to format the text in the ruler. For example here is how to display the hours in a 12 hours format:
ruler.FormatStrings = new RulerFormatStrings("hh", "mm", "hh", "mm");

ruler.FormatStrings = New RulerFormatStrings("hh", "mm", "hh", "mm")

Figure 6: Ruler Format String

WinForms RadScheduler Ruler Format String

The RulerTextFormatting event can be used to manually format the text. You can prepend a "0" in front of the text if it contains only one digit:

this.scheduler.RulerTextFormatting += Scheduler_RulerTextFormatting;

AddHandler Me.scheduler.RulerTextFormatting, AddressOf Scheduler_RulerTextFormatting

void Scheduler_RulerTextFormatting(object sender, RulerTextFormattingEventArgs e)
    if (e.Text.Length == 1)
        e.Text = "0" + e.Text;

Private Sub Scheduler_RulerTextFormatting(sender As Object, e As RulerTextFormattingEventArgs)
    If e.Text.Length = 1 Then
        e.Text = "0" & e.Text
    End If
End Sub

  • RulerWidth - Sets the width of the ruler.
ruler.RulerWidth = 100;

ruler.RulerWidth = 100

Figure 7: Ruler Width

WinForms RadScheduler Ruler Width

See Also

In this article