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

Getting Started with WinForms Clock

  • To add a RadClock to your form, drag a RadClock from the toolbox onto the surface of the form designer.

  • To programmatically add a RadClock to a form, create a new instance of a RadClock, and add it to the form Controls collection.

Adding a RadClock at runtime

RadClock clock = new RadClock();
this.Controls.Add(clock);

Dim clock As New RadClock()
Me.Controls.Add(clock)

The control has three important properties:

  • Value: Used to get or set the value of the control

  • ShowSystemTime: Indicated whether the control will display the system time

  • Offset: Allows you to set time offset - useful to display different time zones

Now let's create a simple application. 1. Add four RadClocks to your RadForm and on the top of each, place a label. 2. Set the labels text to - Sofia, London, New York and Tokyo. 3. In the code behind, set the ShowSystemTime property of the first clock (assuming that your system time show the time in Sofia). 4. For the rest of the clocks, set their Offset properties to: -2, -6, +7:

sofiaClock.ShowSystemTime = true;
londonClock.Offset = new TimeSpan(-2, 0, 0);
newYorkClock.Offset = new TimeSpan(-6, 0, 0);
tokyoClock.Offset = new TimeSpan(7, 0, 0);

sofiaClock.ShowSystemTime = True
londonClock.Offset = New TimeSpan(-2, 0, 0)
newYorkClock.Offset = New TimeSpan(7, 0, 0)
tokyoClock.Offset = New TimeSpan(-6, 0, 0)

Here is the result:

WinForms RadClock Getting Started Example

RELATED VIDEOS
WinForms RadClock Getting Started with RadTimePicker and RadClock for WinForms
In this video, we are going to demonstrate the new RadTimePicker and RadClock controls as well as several properties you should be aware of.
WinForms RadClock clock-getting-started 002

See Also

Telerik UI for WinForms Learning Resources

In this article