HypernovaDesktop Components · docs
Binarymission
WinFormsClock Control › Clock

Clock

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WinForms.Controls.TimeControls

A heavily customisable Clock .NET Control for WinForms .NET.

public class Clock : DoubleBufferedControlBase

Inherits from / implements: DoubleBufferedControlBase

Members at a glance

ClockInitializes a new instance of the Clock class.
BackgroundEndColorGets or sets the end color of the background.
BackgroundStartColorGets or sets the start color of the background.
BorderEndColorGets or sets the end color of the border.
BorderGlassEndColorGets or sets the end color of the border glass.
BorderGlassRenderingAlphaComponentGets or sets the border glass rendering alpha component.
BorderGlassStartColorGets or sets the start color of the border glass.
BorderStartColorGets or sets the start color of the border.
BorderThicknessGets or sets the border thickness.
DropShadowColorGets or sets the color of the drop-shadow.
GlassEndColorGets or sets the end color of the glass.
GlassRenderingAlphaComponentGets or sets the glass rendering alpha component.
GlassStartColorGets or sets the start color of the glass.
GradientDrawingAngleForCircularArtefactsGets or sets the gradient drawing angle for circular artefacts.
GradientDrawingAngleForTimeNeedlesGets or sets the gradient drawing angle for time needles.
HourHandEndColorGets or sets the end color of the hour hand.
HourHandStartColorGets or sets the start color of the hour hand.
HourNeedleWidthGets or sets the width of the hour needle, in logical (96 DPI) units. The default is 9.
InnerRingEndColorGets or sets the end color of the inner ring.
InnerRingShapeBoundsGets or sets the inner ring shape bounds.
InnerRingStartColorGets or sets the start color of the inner ring.
MaxBorderThicknessGets or sets the maximum border thickness.
MinuteHandEndColorGets or sets the end color of the minute hand.
MinuteHandStartColorGets or sets the start color of the minute hand.
MinuteIndicatorVisualGets or sets the minute indicator visual.
MinuteIndicatorVisualColorGets or sets the color of the minute indicator visual.
MinuteIndicatorVisualFontGets or sets the minute indicator visual's font.
MinuteNeedleWidthGets or sets the width of the minute needle, in logical (96 DPI) units. The default is 6.
NumeralsColorGets or sets the color of the numerals.
NumeralsFontGets or sets the numerals font.
RefreshIntervalGets or sets the refresh interval.
SecondHandEndColorGets or sets the end color of the second hand.
SecondHandStartColorGets or sets the start color of the second hand.
SecondNeedleWidthGets or sets the width of the second needle, in logical (96 DPI) units. The default is 2.
ShouldDrawBorderGets or sets a value indicating whether the control should draw border.
ShouldDrawDropShadowForTimeHandlesGets or sets a value indicating whether the control should draw drop-shadow for time handles.
ShouldDrawGlassEffectGets or sets a value indicating whether the control should draw glass effect.
ShouldDrawGlassEffectOnBorderGets or sets a value indicating whether the control should draw glass effect on its border.
ShouldDrawInnerRingGets or sets a value indicating whether the control should draw inner ring.
ShouldDrawMinuteIndicatorVisualGets or sets a value indicating whether the control should draw minute indicator visual.
ShouldDrawNumeralsGets or sets a value indicating whether the control shouldshould draw numerals.
ShouldDropShadowBeEnabledGets or sets a value indicating whether the control should enable the drop-shadow for the clock.
StaticTimeGets or sets the static time.
TimeGets the time the clock shows: StaticTime when it is set, otherwise the time now in TimeZoneId's zone, or on this computer when that is empty.
TimeRepresentationModeGets or sets the time representation mode.
TimeZoneIdGets or sets the identifier of the time zone whose time the clock shows - a Windows time-zone id such as "Eastern Standard Time" or "Tokyo Standard Time" - or null for the computer's own.
OnPaintRaises the Paint event. Clock overrides it so the control's own handling runs alongside the base behavior.
RestartRestarts the timer in the control.

Constructors

Clock

public Clock()

Initializes a new instance of the Clock class.

Properties

BackgroundEndColor

public Color BackgroundEndColor

Gets or sets the end color of the background.

BackgroundStartColor

public Color BackgroundStartColor

Gets or sets the start color of the background.

BorderEndColor

public Color BorderEndColor

Gets or sets the end color of the border.

BorderGlassEndColor

public Color BorderGlassEndColor

Gets or sets the end color of the border glass.

Value. The end color of the border glass.

BorderGlassRenderingAlphaComponent

public int BorderGlassRenderingAlphaComponent

Gets or sets the border glass rendering alpha component.

Value. The border glass rendering alpha component.

BorderGlassStartColor

public Color BorderGlassStartColor

Gets or sets the start color of the border glass.

Value. The start color of the border glass.

BorderStartColor

public Color BorderStartColor

Gets or sets the start color of the border.

BorderThickness

public int BorderThickness

Gets or sets the border thickness.

DropShadowColor

public Color DropShadowColor

Gets or sets the color of the drop-shadow.

GlassEndColor

public Color GlassEndColor

Gets or sets the end color of the glass.

Value. The end color of the glass.

GlassRenderingAlphaComponent

public int GlassRenderingAlphaComponent

Gets or sets the glass rendering alpha component.

Value. The glass rendering alpha component.

GlassStartColor

public Color GlassStartColor

Gets or sets the start color of the glass.

Value. The start color of the glass.

GradientDrawingAngleForCircularArtefacts

public float GradientDrawingAngleForCircularArtefacts

Gets or sets the gradient drawing angle for circular artefacts.

Value. The gradient drawing angle for circular artefacts.

GradientDrawingAngleForTimeNeedles

public float GradientDrawingAngleForTimeNeedles

Gets or sets the gradient drawing angle for time needles.

Value. The gradient drawing angle for time needles.

HourHandEndColor

public Color HourHandEndColor

Gets or sets the end color of the hour hand.

HourHandStartColor

public Color HourHandStartColor

Gets or sets the start color of the hour hand.

HourNeedleWidth

public int HourNeedleWidth

Gets or sets the width of the hour needle, in logical (96 DPI) units. The default is 9.

Value. The width of the hour needle.

The hour and minute hands are drawn with rounded ends. Their lengths are fixed fractions of the dial's radius - about a half, seven tenths and four fifths for the hour, minute and second hands - so a clock of any size, on any display, has the same proportions.

InnerRingEndColor

public Color InnerRingEndColor

Gets or sets the end color of the inner ring.

InnerRingShapeBounds

public Rectangle InnerRingShapeBounds

Gets or sets the inner ring shape bounds.

InnerRingStartColor

public Color InnerRingStartColor

Gets or sets the start color of the inner ring.

MaxBorderThickness

public int MaxBorderThickness

Gets or sets the maximum border thickness.

Value. The maximum border thickness.

MinuteHandEndColor

public Color MinuteHandEndColor

Gets or sets the end color of the minute hand.

MinuteHandStartColor

public Color MinuteHandStartColor

Gets or sets the start color of the minute hand.

MinuteIndicatorVisual

public string MinuteIndicatorVisual

Gets or sets the minute indicator visual.

Value. The minute indicator visual.

MinuteIndicatorVisualColor

public Color MinuteIndicatorVisualColor

Gets or sets the color of the minute indicator visual.

Value. The color of the minute indicator visual.

MinuteIndicatorVisualFont

public Font MinuteIndicatorVisualFont

Gets or sets the minute indicator visual's font.

Value. The minute indicator visual's font.

MinuteNeedleWidth

public int MinuteNeedleWidth

Gets or sets the width of the minute needle, in logical (96 DPI) units. The default is 6.

Value. The width of the minute needle.

NumeralsColor

public Color NumeralsColor

Gets or sets the color of the numerals.

Value. The color of the numerals.

NumeralsFont

public Font NumeralsFont

Gets or sets the numerals font.

Value. The numerals font.

RefreshInterval

public int RefreshInterval

Gets or sets the refresh interval.

SecondHandEndColor

public Color SecondHandEndColor

Gets or sets the end color of the second hand.

SecondHandStartColor

public Color SecondHandStartColor

Gets or sets the start color of the second hand.

SecondNeedleWidth

public int SecondNeedleWidth

Gets or sets the width of the second needle, in logical (96 DPI) units. The default is 2.

Value. The width of the second needle.

ShouldDrawBorder

public bool ShouldDrawBorder

Gets or sets a value indicating whether the control should draw border.

Value. true if the control should draw border; otherwise, false .

ShouldDrawDropShadowForTimeHandles

public bool ShouldDrawDropShadowForTimeHandles

Gets or sets a value indicating whether the control should draw drop-shadow for time handles.

ShouldDrawGlassEffect

public bool ShouldDrawGlassEffect

Gets or sets a value indicating whether the control should draw glass effect.

Value. true if the control should draw glass effect; otherwise, false .

ShouldDrawGlassEffectOnBorder

public bool ShouldDrawGlassEffectOnBorder

Gets or sets a value indicating whether the control should draw glass effect on its border.

Value. true if the control should draw glass effect on its border; otherwise, false .

ShouldDrawInnerRing

public bool ShouldDrawInnerRing

Gets or sets a value indicating whether the control should draw inner ring.

Value. true if the control should draw inner ring; otherwise, false .

ShouldDrawMinuteIndicatorVisual

public bool ShouldDrawMinuteIndicatorVisual

Gets or sets a value indicating whether the control should draw minute indicator visual.

Value. true if the control should draw minute indicator visual; otherwise, false .

ShouldDrawNumerals

public bool ShouldDrawNumerals

Gets or sets a value indicating whether the control shouldshould draw numerals.

Value. true if the control should draw numerals; otherwise, false .

ShouldDropShadowBeEnabled

public bool ShouldDropShadowBeEnabled

Gets or sets a value indicating whether the control should enable the drop-shadow for the clock.

StaticTime

public DateTime? StaticTime

Gets or sets the static time.

Value. The static time.

Time

public DateTime Time

Gets the time the clock shows: StaticTime when it is set, otherwise the time now in TimeZoneId's zone, or on this computer when that is empty.

Value. The time.

TimeRepresentationMode

public TimeRepresentationMode TimeRepresentationMode

Gets or sets the time representation mode.

Value. The time representation mode.

TimeZoneId

public string TimeZoneId

Gets or sets the identifier of the time zone whose time the clock shows - a Windows time-zone id such as "Eastern Standard Time" or "Tokyo Standard Time" - or null for the computer's own.

The clock keeps running in that zone, daylight saving included, which is what a row of world clocks needs: StaticTime can only stop a hand, and a demo that used it to show four faces showed three that never moved (HANDOVER 3bb). StaticTime still wins while it is set. An id the computer does not know throws TimeZoneNotFoundException, so a mistyped one is seen at once rather than quietly showing local time.

Methods

OnPaint

protected override void OnPaint(PaintEventArgs e)

Raises the Paint event. Clock overrides it so the control's own handling runs alongside the base behavior.

e
The data for the event.

Restart

public void Restart()

Restarts the timer in the control.