UCLEDData.cs 3.5 KB

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