syncfusion-winforms-clock
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImplementing the Syncfusion WinForms Clock Control
实现Syncfusion WinForms Clock控件
The Syncfusion control () is a display-only control that shows the current time as either an analog or digital clock. It supports extensive visual customization — hand colors and thickness, gradient backgrounds, frames and shapes for digital mode, transparency, and a fully replaceable rendering pipeline.
ClockSyncfusion.Windows.Forms.Tools.ClockSyncfusion 控件()是一个仅用于展示的控件,可显示为模拟或数字时钟样式的当前时间。它支持丰富的视觉自定义能力:指针颜色与粗细、渐变背景、数字模式下的边框和形状、透明度,以及完全可替换的渲染管线。
ClockSyncfusion.Windows.Forms.Tools.ClockWhen to Use This Skill
何时使用本指南
Use this skill when you need to:
- Add a clock display (analog or digital) to a WinForms form
- Switch between analog and digital modes via
ClockType - Customize colors — gradient background, hand colors, border, minute lines
- Configure digital clock frames or shapes — ,
ClockFrameClockShape - Show a fixed or custom time — +
ShowCustomTimeClockCustomTime - Freeze the clock at a specific time —
StopTimer - Apply a custom renderer — override or
ClockRenderer.DrawInteriorDigitalClockRenderer.DrawDigitalClockFrame
当你需要完成以下操作时可使用本指南:
- 为WinForms窗体添加时钟展示(模拟或数字样式)
- 通过在模拟和数字模式之间切换
ClockType - 自定义颜色:渐变背景、指针颜色、边框、分钟刻度线
- 配置数字时钟边框或形状:、
ClockFrameClockShape - 展示固定或自定义时间:+
ShowCustomTimeClockCustomTime - 将时钟固定在特定时间:
StopTimer - 应用自定义渲染器:重写或
ClockRenderer.DrawInteriorDigitalClockRenderer.DrawDigitalClockFrame
Component Overview
组件概览
| Property | Type | Description |
|---|---|---|
| | |
| | Enable custom (non-system) time display |
| | The custom time to display when |
| | Freeze the clock at its current time |
| | Transparent background (analog) |
| | Custom renderer for analog clock hands |
| | Custom renderer for digital clock frame |
| 属性 | 类型 | 描述 |
|---|---|---|
| | 可选值为 |
| | 启用自定义(非系统)时间展示 |
| | 当 |
| | 将时钟固定在当前时间 |
| | 透明背景(仅模拟时钟生效) |
| | 模拟时钟指针的自定义渲染器 |
| | 数字时钟边框的自定义渲染器 |
Documentation and Navigation Guide
文档与导航指南
Getting Started
入门指南
📄 Read: references/getting-started.md
- Assembly references and NuGet package setup
- Adding Clock via designer or programmatically
- Switching between analog and digital modes ()
ClockType - Displaying a fixed or custom time (,
ShowCustomTimeClock)CustomTime - Freezing the clock ()
StopTimer
📄 阅读: references/getting-started.md
- 程序集引用与NuGet包配置
- 通过设计器或代码添加Clock控件
- 在模拟和数字模式之间切换()
ClockType - 展示固定或自定义时间(、
ShowCustomTimeClock)CustomTime - 固定时钟时间()
StopTimer
Appearance and Color Customization
外观与颜色自定义
📄 Read: references/appearance-and-color.md
- Gradient background colors (,
StartGradientBackColor)EndGradientBackColor - Hand colors (,
HourHandColor,MinuteHandColor)SecondHandColor - Minute line and border colors (,
MinuteColor)BorderColor - Hand thickness (,
HourHandThickness,MinuteHandThickness,SecondHandThickness)MinuteThickness - Show/hide toggles (,
ShowAMorPM,ShowBorder,ShowMinute)ShowSecondHand - Transparent background ()
IsTransparent
📄 阅读: references/appearance-and-color.md
- 渐变背景颜色(、
StartGradientBackColor)EndGradientBackColor - 指针颜色(、
HourHandColor、MinuteHandColor)SecondHandColor - 分钟刻度线与边框颜色(、
MinuteColor)BorderColor - 指针粗细(、
HourHandThickness、MinuteHandThickness、SecondHandThickness)MinuteThickness - 显示/隐藏开关(、
ShowAMorPM、ShowBorder、ShowMinute)ShowSecondHand - 透明背景()
IsTransparent
Digital Clock
数字时钟
📄 Read: references/digital-clock.md
- Enabling digital mode
- Frames vs shapes — mutually exclusive; use to switch
ShowClockFrame - values:
ClockFrame,RectangularFrame,CircularFrameSquareFrame - values:
ClockShape,Rectangle,RoundedRectangle,Circle,SquareRoundedSquare - Color customization: ,
ForeColor,BackgroundColorBorderColor - Behavior: ,
DisplayDatesShowHourDesignator - Custom time in digital mode
- Custom digital frame renderer ()
DigitalRenderer
📄 阅读: references/digital-clock.md
- 启用数字模式
- 边框与形状互斥,可通过切换
ShowClockFrame - 可选值:
ClockFrame、RectangularFrame、CircularFrameSquareFrame - 可选值:
ClockShape、Rectangle、RoundedRectangle、Circle、SquareRoundedSquare - 颜色自定义:、
ForeColor、BackgroundColorBorderColor - 行为配置:、
DisplayDatesShowHourDesignator - 数字模式下的自定义时间
- 自定义数字边框渲染器()
DigitalRenderer
Custom Renderer (Analog)
自定义渲染器(模拟时钟)
📄 Read: references/custom-renderer.md
- Subclassing and overriding
ClockRendererDrawInterior - values:
sender,"SecondsHand","MinutesHand", minute lines ("HoursHand")else - Customizing pens with ,
LineCapDashStyle - Assigning the renderer to the clock
📄 阅读: references/custom-renderer.md
- 继承并重写
ClockRenderer方法DrawInterior - 可选值:
sender、"SecondsHand"、"MinutesHand",其余值对应分钟刻度线"HoursHand" - 使用、
LineCap自定义画笔DashStyle - 为时钟控件指定渲染器
Quick Start
快速开始
C# — Analog clock, programmatic:
csharp
using Syncfusion.Windows.Forms.Tools;
Clock clock1 = new Clock();
clock1.ClockType = ClockTypes.Analog;
clock1.StartGradientBackColor = Color.Black;
clock1.HourHandColor = Color.SkyBlue;
clock1.MinuteHandColor = Color.LightSeaGreen;
clock1.SecondHandColor = Color.LightSteelBlue;
this.Controls.Add(clock1);VB.NET — Digital clock:
vb
Imports Syncfusion.Windows.Forms.Tools
Dim clock1 As New Clock()
clock1.ClockType = ClockTypes.Digital
clock1.ShowClockFrame = True
clock1.ClockFrame = ClockFrames.RectangularFrame
Me.Controls.Add(clock1)C# — 模拟时钟,代码实现:
csharp
using Syncfusion.Windows.Forms.Tools;
Clock clock1 = new Clock();
clock1.ClockType = ClockTypes.Analog;
clock1.StartGradientBackColor = Color.Black;
clock1.HourHandColor = Color.SkyBlue;
clock1.MinuteHandColor = Color.LightSeaGreen;
clock1.SecondHandColor = Color.LightSteelBlue;
this.Controls.Add(clock1);VB.NET — 数字时钟:
vb
Imports Syncfusion.Windows.Forms.Tools
Dim clock1 As New Clock()
clock1.ClockType = ClockTypes.Digital
clock1.ShowClockFrame = True
clock1.ClockFrame = ClockFrames.RectangularFrame
Me.Controls.Add(clock1)Common Use Cases
常见使用场景
| Scenario | Properties to Set |
|---|---|
| Show live analog clock | |
| Show digital clock with frame | |
| Freeze at a specific time | |
| Show custom/fixed time | |
| Transparent analog overlay | |
| Custom hand rendering | Subclass |
| Custom digital frame | Subclass |
| 场景 | 需要设置的属性 |
|---|---|
| 展示实时模拟时钟 | |
| 展示带边框的数字时钟 | |
| 固定在特定时间 | |
| 展示自定义/固定时间 | |
| 透明模拟时钟浮层 | |
| 自定义指针渲染 | 继承 |
| 自定义数字边框 | 继承 |