UCLEDTime.cs
3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 09-02-2019
//
// ***********************************************************************
// <copyright file="UCLEDTime.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HZH_Controls.Controls
{
/// <summary>
/// Class UCLEDTime.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
public partial class UCLEDTime : UserControl
{
/// <summary>
/// The m value
/// </summary>
private DateTime m_value;
/// <summary>
/// Gets or sets the value.
/// </summary>
/// <value>The value.</value>
[Description("值"), Category("自定义")]
public DateTime Value
{
get { return m_value; }
set
{
m_value = value;
string str = value.ToString("HH:mm:ss");
for (int i = 0; i < str.Length; i++)
{
((UCLEDNum)this.tableLayoutPanel1.Controls.Find("D" + (i + 1), false)[0]).Value = str[i];
}
}
}
/// <summary>
/// The m line width
/// </summary>
private int m_lineWidth = 8;
/// <summary>
/// Gets or sets the width of the line.
/// </summary>
/// <value>The width of the line.</value>
[Description("线宽度,为了更好的显示效果,请使用偶数"), Category("自定义")]
public int LineWidth
{
get { return m_lineWidth; }
set
{
m_lineWidth = value;
foreach (UCLEDNum c in this.tableLayoutPanel1.Controls)
{
c.LineWidth = value;
}
}
}
/// <summary>
/// 获取或设置控件的前景色。
/// </summary>
/// <value>The color of the fore.</value>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
[Description("颜色"), Category("自定义")]
public override System.Drawing.Color ForeColor
{
get
{
return base.ForeColor;
}
set
{
base.ForeColor = value;
foreach (UCLEDNum c in this.tableLayoutPanel1.Controls)
{
c.ForeColor = value;
}
}
}
/// <summary>
/// Initializes a new instance of the <see cref="UCLEDTime" /> class.
/// </summary>
public UCLEDTime()
{
InitializeComponent();
Value = DateTime.Now;
}
}
}