赞
踩
入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章。
GitHub:https://github.com/kwwwvagaa/NetWinformControl
码云:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
如果觉得写的还行,请点个 star 支持一下吧
麻烦博客下方点个【推荐】,谢谢
Install-Package HZH_Controls
https://blog.csdn.net/kwwwvagaa/article/details/100586547
使用GID+画的,不了解的话请自行百度
添加一个类UCLEDNum ,继承UserControl
将数字拆分为单独的字,然后根据显示位置进行画出来,将显示位置定义为如下所示
- /* 显示位置序号
- * ****1***
- * * *
- * 6 2
- * * *
- * ****7***
- * * *
- * 5 3
- * * *
- * ****4***
- */
从上面可以看出,定义了1-7的位置,然后定义一个数字对应的显示列表
1 private static Dictionary<char, int[]> m_nums = new Dictionary<char, int[]>(); 2 static UCLEDNum() 3 { 4 m_nums['0'] = new int[] { 1, 2, 3, 4, 5, 6 }; 5 m_nums['1'] = new int[] { 2, 3 }; 6 m_nums['2'] = new int[] { 1, 2, 5, 4, 7 }; 7 m_nums['3'] = new int[] { 1, 2, 7, 3, 4 }; 8 m_nums['4'] = new int[] { 2, 3, 6, 7 }; 9 m_nums['5'] = new int[] { 1, 6, 7, 3, 4 }; 10 m_nums['6'] = new int[] { 1, 6, 5, 4, 3, 7 }; 11 m_nums['7'] = new int[] { 1, 2, 3 }; 12 m_nums['8'] = new int[] { 1, 2, 3, 4, 5, 6, 7 }; 13 m_nums['9'] = new int[] { 1, 2, 3, 4, 7, 6 }; 14 m_nums['-'] = new int[] { 7 }; 15 m_nums[':'] = new int[0]; 16 m_nums['.'] = new int[0]; 17 }
你看到了还有“-”,“:”,“.”这3个符号,是为了时间和数字时候使用
然后定义一个矩形区域来用作绘画区域,并且在SizeChanged事件中赋值
- Rectangle m_drawRect = Rectangle.Empty;
- void LEDNum_SizeChanged(object sender, EventArgs e)
- {
- m_drawRect = new Rectangle(1, 1, this.Width - 2, this.Height - 2);
- }
然后就是几个属性
1 private char m_value = '0'; 2 3 [Description("值"), Category("自定义")] 4 public char Value 5 { 6 get { return m_value; } 7 set 8 { 9 if (!m_nums.ContainsKey(value)) 10 { 11 return; 12 } 13 if (m_value != value) 14 { 15 m_value = value; 16 Refresh(); 17 } 18 } 19 } 20 21 private int m_lineWidth = 8; 22 23 [Description("线宽度,为了更好的显示效果,请使用偶数"), Category("自定义")] 24 public int LineWidth 25 { 26 get { return m_lineWidth; } 27 set 28 { 29 m_lineWidth = value; 30 Refresh(); 31 } 32 } 33 34 [Description("颜色"), Category("自定义")] 35 public override System.Drawing.Color ForeColor 36 { 37 get 38 { 39 return base.ForeColor; 40 } 41 set 42 { 43 base.ForeColor = value; 44 } 45 }
最重要的重绘
1 protected override void OnPaint(PaintEventArgs e) 2 { 3 base.OnPaint(e); 4 e.Graphics.SetGDIHigh(); 5 if (m_value == '.') 6 { 7 Rectangle r2 = new Rectangle(m_drawRect.Left + (m_drawRect.Width - m_lineWidth) / 2, m_drawRect.Bottom - m_lineWidth * 2, m_lineWidth, m_lineWidth); 8 e.Graphics.FillRectangle(new SolidBrush(ForeColor), r2); 9 } 10 else if (m_value == ':') 11 { 12 Rectangle r1 = new Rectangle(m_drawRect.Left + (m_drawRect.Width - m_lineWidth) / 2, m_drawRect.Top + (m_drawRect.Height / 2 - m_lineWidth) / 2, m_lineWidth, m_lineWidth); 13 e.Graphics.FillRectangle(new SolidBrush(ForeColor), r1); 14 Rectangle r2 = new Rectangle(m_drawRect.Left + (m_drawRect.Width - m_lineWidth) / 2, m_drawRect.Top + (m_drawRect.Height / 2 - m_lineWidth) / 2 + m_drawRect.Height / 2, m_lineWidth, m_lineWidth); 15 e.Graphics.FillRectangle(new SolidBrush(ForeColor), r2); 16 } 17 else 18 { 19 int[] vs = m_nums[m_value]; 20 if (vs.Contains(1)) 21 { 22 GraphicsPath path = new GraphicsPath(); 23 path.AddLines(new Point[] 24 { 25 new Point(m_drawRect.Left + 2, m_drawRect.Top), 26 new Point(m_drawRect.Right - 2, m_drawRect.Top), 27 new Point(m_drawRect.Right - m_lineWidth-2, m_drawRect.Top+m_lineWidth), 28 new Point(m_drawRect.Left + m_lineWidth+2, m_drawRect.Top+m_lineWidth), 29 new Point(m_drawRect.Left + 2, m_drawRect.Top) 30 }); 31 path.CloseAllFigures(); 32 e.Graphics.FillPath(new SolidBrush(ForeColor), path); 33 } 34 35 if (vs.Contains(2)) 36 { 37 GraphicsPath path = new GraphicsPath(); 38 path.AddLines(new Point[] 39 { 40 new Point(m_drawRect.Right, m_drawRect.Top), 41 new Point(m_drawRect.Right, m_drawRect.Top+(m_drawRect.Height-m_lineWidth-4)/2), 42 new Point(m_drawRect.Right-m_lineWidth/2, m_drawRect.Top+(m_drawRect.Height-m_lineWidth-4)/2+m_lineWidth/2), 43 new Point(m_drawRect.Right-m_lineWidth, m_drawRect.Top+(m_drawRect.Height-m_lineWidth-4)/2), 44 new Point(m_drawRect.Right-m_lineWidth, m_drawRect.Top+m_lineWidth), 45 new Point(m_drawRect.Right, m_drawRect.Top) 46 }); 47 path.CloseAllFigures(); 48 e.Graphics.FillPath(new SolidBrush(ForeColor), path); 49 } 50 51 if (vs.Contains(3)) 52 { 53 GraphicsPath path = new GraphicsPath(); 54 path.AddLines(new Point[] 55 { 56 new Point(m_drawRect.Right, m_drawRect.Bottom-(m_drawRect.Height-m_lineWidth-4)/2), 57 new Point(m_drawRect.Right, m_drawRect.Bottom), 58 new Point(m_drawRect.Right-m_lineWidth, m_drawRect.Bottom-m_lineWidth), 59 new Point(m_drawRect.Right-m_lineWidth, m_drawRect.Bottom-(m_drawRect.Height-m_lineWidth-4)/2), 60 new Point(m_drawRect.Right-m_lineWidth/2, m_drawRect.Bottom-(m_drawRect.Height-m_lineWidth-4)/2-m_lineWidth/2), 61 new Point(m_drawRect.Right, m_drawRect.Bottom-(m_drawRect.Height-m_lineWidth-4)/2), 62 }); 63 path.CloseAllFigures(); 64 e.Graphics.FillPath(new SolidBrush(ForeColor), path); 65 } 66 67 if (vs.Contains(4)) 68 { 69 GraphicsPath path = new GraphicsPath(); 70 path.AddLines(new Point[] 71 { 72 new Point(m_drawRect.Left + 2, m_drawRect.Bottom), 73 new Point(m_drawRect.Right - 2, m_drawRect.Bottom), 74 new Point(m_drawRect.Right - m_lineWidth-2, m_drawRect.Bottom-m_lineWidth), 75 new Point(m_drawRect.Left + m_lineWidth+2, m_drawRect.Bottom-m_lineWidth), 76 new Point(m_drawRect.Left + 2, m_drawRect.Bottom) 77 }); 78 path.CloseAllFigures(); 79 e.Graphics.FillPath(new SolidBrush(ForeColor), path); 80 } 81 82 if (vs.Contains(5)) 83 { 84 GraphicsPath path = new GraphicsPath(); 85 path.AddLines(new Point[] 86 { 87 new Point(m_drawRect.Left, m_drawRect.Bottom-(m_drawRect.Height-m_lineWidth-4)/2), 88 new Point(m_drawRect.Left, m_drawRect.Bottom), 89 new Point(m_drawRect.Left+m_lineWidth, m_drawRect.Bottom-m_lineWidth), 90 new Point(m_drawRect.Left+m_lineWidth, m_drawRect.Bottom-(m_drawRect.Height-m_lineWidth-4)/2), 91 new Point(m_drawRect.Left+m_lineWidth/2, m_drawRect.Bottom-(m_drawRect.Height-m_lineWidth-4)/2-m_lineWidth/2), 92 new Point(m_drawRect.Left, m_drawRect.Bottom-(m_drawRect.Height-m_lineWidth-4)/2), 93 }); 94 path.CloseAllFigures(); 95 e.Graphics.FillPath(new SolidBrush(ForeColor), path); 96 } 97 98 99 if (vs.Contains(6)) 100 { 101 GraphicsPath path = new GraphicsPath(); 102 path.AddLines(new Point[] 103 { 104 new Point(m_drawRect.Left, m_drawRect.Top), 105 new Point(m_drawRect.Left, m_drawRect.Top+(m_drawRect.Height-m_lineWidth-4)/2), 106 new Point(m_drawRect.Left+m_lineWidth/2, m_drawRect.Top+(m_drawRect.Height-m_lineWidth-4)/2+m_lineWidth/2), 107 new Point(m_drawRect.Left+m_lineWidth, m_drawRect.Top+(m_drawRect.Height-m_lineWidth-4)/2), 108 new Point(m_drawRect.Left+m_lineWidth, m_drawRect.Top+m_lineWidth), 109 new Point(m_drawRect.Left, m_drawRect.Top) 110 }); 111 path.CloseAllFigures(); 112 e.Graphics.FillPath(new SolidBrush(ForeColor), path); 113 } 114 115 if (vs.Contains(7)) 116 { 117 GraphicsPath path = new GraphicsPath(); 118 path.AddLines(new Point[] 119 { 120 new Point(m_drawRect.Left+m_lineWidth/2, m_drawRect.Height/2+1), 121 new Point(m_drawRect.Left+m_lineWidth, m_drawRect.Height/2-m_lineWidth/2+1), 122 new Point(m_drawRect.Right-m_lineWidth, m_drawRect.Height/2-m_lineWidth/2+1), 123 new Point(m_drawRect.Right-m_lineWidth/2, m_drawRect.Height/2+1), 124 new Point(m_drawRect.Right-m_lineWidth, m_drawRect.Height/2+m_lineWidth/2+1), 125 new Point(m_drawRect.Left+m_lineWidth, m_drawRect.Height/2+m_lineWidth/2+1), 126 new Point(m_drawRect.Left+m_lineWidth/2, m_drawRect.Height/2+1) 127 }); 128 path.CloseAllFigures(); 129 e.Graphics.FillPath(new SolidBrush(ForeColor), path); 130 } 131 } 132 }
完工,看下完整代码和效果
View Code
以上就是单个字符的了
=======================分割线==========================
下面对数字控件处理
添加一个用户控件UCLEDNums
添加一点属性
1 private string m_value; 2 3 [Description("值"), Category("自定义")] 4 public string Value 5 { 6 get { return m_value; } 7 set 8 { 9 m_value = value; 10 ReloadValue(); 11 } 12 } 13 14 private int m_lineWidth = 8; 15 16 [Description("线宽度,为了更好的显示效果,请使用偶数"), Category("自定义")] 17 public int LineWidth 18 { 19 get { return m_lineWidth; } 20 set 21 { 22 m_lineWidth = value; 23 foreach (UCLEDNum c in this.Controls) 24 { 25 c.LineWidth = value; 26 } 27 } 28 } 29 30 [Description("颜色"), Category("自定义")] 31 public override System.Drawing.Color ForeColor 32 { 33 get 34 { 35 return base.ForeColor; 36 } 37 set 38 { 39 base.ForeColor = value; 40 foreach (UCLEDNum c in this.Controls) 41 { 42 c.ForeColor = value; 43 } 44 } 45 } 46 47 public override RightToLeft RightToLeft 48 { 49 get 50 { 51 return base.RightToLeft; 52 } 53 set 54 { 55 base.RightToLeft = value; 56 ReloadValue(); 57 } 58 }
加载控件的函数
1 private void ReloadValue() 2 { 3 try 4 { 5 ControlHelper.FreezeControl(this, true); 6 this.Controls.Clear(); 7 foreach (var item in m_value) 8 { 9 UCLEDNum uc = new UCLEDNum(); 10 if (RightToLeft == System.Windows.Forms.RightToLeft.Yes) 11 uc.Dock = DockStyle.Right; 12 else 13 uc.Dock = DockStyle.Left; 14 uc.Value = item; 15 uc.ForeColor = ForeColor; 16 uc.LineWidth = m_lineWidth; 17 this.Controls.Add(uc); 18 if (RightToLeft == System.Windows.Forms.RightToLeft.Yes) 19 uc.SendToBack(); 20 else 21 uc.BringToFront(); 22 } 23 } 24 finally 25 { 26 ControlHelper.FreezeControl(this, false); 27 } 28 }
完整代码及效果
View Code
View Code
=======================分割线==========================
下面是日期类控件了,这里偷懒,分成3个控件,分别是日期控件,时间控件,日期时间控件
先说日期控件,
添加一个用户控件UCLEDData
添加属性
1 private DateTime m_value; 2 3 [Description("值"), Category("自定义")] 4 public DateTime Value 5 { 6 get { return m_value; } 7 set 8 { 9 m_value = value; 10 string str = value.ToString("yyyy-MM-dd"); 11 for (int i = 0; i < str.Length; i++) 12 { 13 ((UCLEDNum)this.tableLayoutPanel1.Controls.Find("D" + (i + 1), false)[0]).Value = str[i]; 14 } 15 } 16 } 17 18 private int m_lineWidth = 8; 19 20 [Description("线宽度,为了更好的显示效果,请使用偶数"), Category("自定义")] 21 public int LineWidth 22 { 23 get { return m_lineWidth; } 24 set 25 { 26 m_lineWidth = value; 27 foreach (UCLEDNum c in this.tableLayoutPanel1.Controls) 28 { 29 c.LineWidth = value; 30 } 31 } 32 } 33 34 [Description("颜色"), Category("自定义")] 35 public override System.Drawing.Color ForeColor 36 { 37 get 38 { 39 return base.ForeColor; 40 } 41 set 42 { 43 base.ForeColor = value; 44 foreach (UCLEDNum c in this.tableLayoutPanel1.Controls) 45 { 46 c.ForeColor = value; 47 } 48 } 49 }
完整代码
View Code
View Code
=======================分割线==========================
时间控件
添加一个用户控件UCLEDTime
添加属性
1 private DateTime m_value; 2 3 [Description("值"), Category("自定义")] 4 public DateTime Value 5 { 6 get { return m_value; } 7 set 8 { 9 m_value = value; 10 string str = value.ToString("HH:mm:ss"); 11 for (int i = 0; i < str.Length; i++) 12 { 13 ((UCLEDNum)this.tableLayoutPanel1.Controls.Find("D" + (i + 1), false)[0]).Value = str[i]; 14 } 15 } 16 } 17 18 private int m_lineWidth = 8; 19 20 [Description("线宽度,为了更好的显示效果,请使用偶数"), Category("自定义")] 21 public int LineWidth 22 { 23 get { return m_lineWidth; } 24 set 25 { 26 m_lineWidth = value; 27 foreach (UCLEDNum c in this.tableLayoutPanel1.Controls) 28 { 29 c.LineWidth = value; 30 } 31 } 32 } 33 34 [Description("颜色"), Category("自定义")] 35 public override System.Drawing.Color ForeColor 36 { 37 get 38 { 39 return base.ForeColor; 40 } 41 set 42 { 43 base.ForeColor = value; 44 foreach (UCLEDNum c in this.tableLayoutPanel1.Controls) 45 { 46 c.ForeColor = value; 47 } 48 } 49 }
全部代码
View Code
View Code
=======================分割线==========================
日期时间控件
添加一个用户控件UCLEDDataTime
添加属性
1 private DateTime m_value; 2 3 [Description("值"), Category("自定义")] 4 public DateTime Value 5 { 6 get { return m_value; } 7 set 8 { 9 m_value = value; 10 string str = value.ToString("yyyy-MM-dd HH:mm:ss"); 11 for (int i = 0; i < str.Length; i++) 12 { 13 if (i == 10) 14 continue; 15 ((UCLEDNum)this.tableLayoutPanel1.Controls.Find("D" + (i + 1), false)[0]).Value = str[i]; 16 } 17 } 18 } 19 20 private int m_lineWidth = 8; 21 22 [Description("线宽度,为了更好的显示效果,请使用偶数"), Category("自定义")] 23 public int LineWidth 24 { 25 get { return m_lineWidth; } 26 set 27 { 28 m_lineWidth = value; 29 foreach (UCLEDNum c in this.tableLayoutPanel1.Controls) 30 { 31 c.LineWidth = value; 32 } 33 } 34 } 35 36 [Description("颜色"), Category("自定义")] 37 public override System.Drawing.Color ForeColor 38 { 39 get 40 { 41 return base.ForeColor; 42 } 43 set 44 { 45 base.ForeColor = value; 46 foreach (UCLEDNum c in this.tableLayoutPanel1.Controls) 47 { 48 c.ForeColor = value; 49 } 50 } 51 }
全部代码
- 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
- {
- public partial class UCLEDDataTime : UserControl
- {
- private DateTime m_value;
-
- [Description("值"), Category("自定义")]
- public DateTime Value
- {
- get { return m_value; }
- set
- {
- m_value = value;
- string str = value.ToString("yyyy-MM-dd HH:mm:ss");
- for (int i = 0; i < str.Length; i++)
- {
- if (i == 10)
- continue;
- ((UCLEDNum)this.tableLayoutPanel1.Controls.Find("D" + (i + 1), false)[0]).Value = str[i];
- }
- }
- }
-
- private int m_lineWidth = 8;
-
- [Description("线宽度,为了更好的显示效果,请使用偶数"), Category("自定义")]
- public int LineWidth
- {
- get { return m_lineWidth; }
- set
- {
- m_lineWidth = value;
- foreach (UCLEDNum c in this.tableLayoutPanel1.Controls)
- {
- c.LineWidth = value;
- }
- }
- }
-
- [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;
- }
- }
- }
- public UCLEDDataTime()
- {
- InitializeComponent();
- Value = DateTime.Now;
- }
- }
- }

- namespace HZH_Controls.Controls
- {
- partial class UCLEDDataTime
- {
- /// <summary>
- /// 必需的设计器变量。
- /// </summary>
- private System.ComponentModel.IContainer components = null;
-
- /// <summary>
- /// 清理所有正在使用的资源。
- /// </summary>
- /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region 组件设计器生成的代码
-
- /// <summary>
- /// 设计器支持所需的方法 - 不要
- /// 使用代码编辑器修改此方法的内容。
- /// </summary>
- private void InitializeComponent()
- {
- this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
- this.D1 = new HZH_Controls.Controls.UCLEDNum();
- this.D2 = new HZH_Controls.Controls.UCLEDNum();
- this.D3 = new HZH_Controls.Controls.UCLEDNum();
- this.D4 = new HZH_Controls.Controls.UCLEDNum();
- this.D5 = new HZH_Controls.Controls.UCLEDNum();
- this.D6 = new HZH_Controls.Controls.UCLEDNum();
- this.D7 = new HZH_Controls.Controls.UCLEDNum();
- this.D8 = new HZH_Controls.Controls.UCLEDNum();
- this.D9 = new HZH_Controls.Controls.UCLEDNum();
- this.D10 = new HZH_Controls.Controls.UCLEDNum();
- this.D12 = new HZH_Controls.Controls.UCLEDNum();
- this.D13 = new HZH_Controls.Controls.UCLEDNum();
- this.D14 = new HZH_Controls.Controls.UCLEDNum();
- this.D15 = new HZH_Controls.Controls.UCLEDNum();
- this.D16 = new HZH_Controls.Controls.UCLEDNum();
- this.D17 = new HZH_Controls.Controls.UCLEDNum();
- this.D18 = new HZH_Controls.Controls.UCLEDNum();
- this.D19 = new HZH_Controls.Controls.UCLEDNum();
- this.tableLayoutPanel1.SuspendLayout();
- this.SuspendLayout();
- //
- // tableLayoutPanel1
- //
- this.tableLayoutPanel1.ColumnCount = 19;
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.263158F));
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.263158F));
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.263158F));
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.263158F));
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.263158F));
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.263158F));
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.263158F));
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.263158F));
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.263158F));
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.263158F));
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.263158F));
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.263158F));
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.263158F));
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.263158F));
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.263158F));
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.263158F));
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.263158F));
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.263158F));
- this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.263158F));
- this.tableLayoutPanel1.Controls.Add(this.D1, 0, 0);
- this.tableLayoutPanel1.Controls.Add(this.D2, 1, 0);
- this.tableLayoutPanel1.Controls.Add(this.D3, 2, 0);
- this.tableLayoutPanel1.Controls.Add(this.D4, 3, 0);
- this.tableLayoutPanel1.Controls.Add(this.D5, 4, 0);
- this.tableLayoutPanel1.Controls.Add(this.D6, 5, 0);
- this.tableLayoutPanel1.Controls.Add(this.D7, 6, 0);
- this.tableLayoutPanel1.Controls.Add(this.D8, 7, 0);
- this.tableLayoutPanel1.Controls.Add(this.D9, 8, 0);
- this.tableLayoutPanel1.Controls.Add(this.D10, 9, 0);
- this.tableLayoutPanel1.Controls.Add(this.D12, 11, 0);
- this.tableLayoutPanel1.Controls.Add(this.D13, 12, 0);
- this.tableLayoutPanel1.Controls.Add(this.D14, 13, 0);
- this.tableLayoutPanel1.Controls.Add(this.D15, 14, 0);
- this.tableLayoutPanel1.Controls.Add(this.D16, 15, 0);
- this.tableLayoutPanel1.Controls.Add(this.D17, 16, 0);
- this.tableLayoutPanel1.Controls.Add(this.D18, 17, 0);
- this.tableLayoutPanel1.Controls.Add(this.D19, 18, 0);
- this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
- this.tableLayoutPanel1.Name = "tableLayoutPanel1";
- this.tableLayoutPanel1.RowCount = 1;
- this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
- this.tableLayoutPanel1.Size = new System.Drawing.Size(650, 58);
- this.tableLayoutPanel1.TabIndex = 1;
- //
- // D1
- //
- this.D1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.D1.LineWidth = 8;
- this.D1.Location = new System.Drawing.Point(3, 3);
- this.D1.Name = "D1";
- this.D1.Size = new System.Drawing.Size(28, 52);
- this.D1.TabIndex = 0;
- this.D1.Value = '2';
- //
- // D2
- //
- this.D2.Dock = System.Windows.Forms.DockStyle.Fill;
- this.D2.LineWidth = 8;
- this.D2.Location = new System.Drawing.Point(37, 3);
- this.D2.Name = "D2";
- this.D2.Size = new System.Drawing.Size(28, 52);
- this.D2.TabIndex = 1;
- this.D2.Value = '0';
- //
- // D3
- //
- this.D3.Dock = System.Windows.Forms.DockStyle.Fill;
- this.D3.LineWidth = 8;
- this.D3.Location = new System.Drawing.Point(71, 3);
- this.D3.Name = "D3";
- this.D3.Size = new System.Drawing.Size(28, 52);
- this.D3.TabIndex = 2;
- this.D3.Value = '1';
- //
- // D4
- //
- this.D4.Dock = System.Windows.Forms.DockStyle.Fill;
- this.D4.LineWidth = 8;
- this.D4.Location = new System.Drawing.Point(105, 3);
- this.D4.Name = "D4";
- this.D4.Size = new System.Drawing.Size(28, 52);
- this.D4.TabIndex = 3;
- this.D4.Value = '9';
- //
- // D5
- //
- this.D5.Dock = System.Windows.Forms.DockStyle.Fill;
- this.D5.LineWidth = 8;
- this.D5.Location = new System.Drawing.Point(139, 3);
- this.D5.Name = "D5";
- this.D5.Size = new System.Drawing.Size(28, 52);
- this.D5.TabIndex = 4;
- this.D5.Value = '-';
- //
- // D6
- //
- this.D6.Dock = System.Windows.Forms.DockStyle.Fill;
- this.D6.LineWidth = 8;
- this.D6.Location = new System.Drawing.Point(173, 3);
- this.D6.Name = "D6";
- this.D6.Size = new System.Drawing.Size(28, 52);
- this.D6.TabIndex = 5;
- this.D6.Value = '0';
- //
- // D7
- //
- this.D7.Dock = System.Windows.Forms.DockStyle.Fill;
- this.D7.LineWidth = 8;
- this.D7.Location = new System.Drawing.Point(207, 3);
- this.D7.Name = "D7";
- this.D7.Size = new System.Drawing.Size(28, 52);
- this.D7.TabIndex = 6;
- this.D7.Value = '8';
- //
- // D8
- //
- this.D8.Dock = System.Windows.Forms.DockStyle.Fill;
- this.D8.LineWidth = 8;
- this.D8.Location = new System.Drawing.Point(241, 3);
- this.D8.Name = "D8";
- this.D8.Size = new System.Drawing.Size(28, 52);
- this.D8.TabIndex = 7;
- this.D8.Value = '-';
- //
- // D9
- //
- this.D9.Dock = System.Windows.Forms.DockStyle.Fill;
- this.D9.LineWidth = 8;
- this.D9.Location = new System.Drawing.Point(275, 3);
- this.D9.Name = "D9";
- this.D9.Size = new System.Drawing.Size(28, 52);
- this.D9.TabIndex = 8;
- this.D9.Value = '0';
- //
- // D10
- //
- this.D10.Dock = System.Windows.Forms.DockStyle.Fill;
- this.D10.LineWidth = 8;
- this.D10.Location = new System.Drawing.Point(309, 3);
- this.D10.Name = "D10";
- this.D10.Size = new System.Drawing.Size(28, 52);
- this.D10.TabIndex = 9;
- this.D10.Value = '1';
- //
- // D12
- //
- this.D12.Dock = System.Windows.Forms.DockStyle.Fill;
- this.D12.LineWidth = 8;
- this.D12.Location = new System.Drawing.Point(377, 3);
- this.D12.Name = "D12";
- this.D12.Size = new System.Drawing.Size(28, 52);
- this.D12.TabIndex = 10;
- this.D12.Value = '2';
- //
- // D13
- //
- this.D13.Dock = System.Windows.Forms.DockStyle.Fill;
- this.D13.LineWidth = 8;
- this.D13.Location = new System.Drawing.Point(411, 3);
- this.D13.Name = "D13";
- this.D13.Size = new System.Drawing.Size(28, 52);
- this.D13.TabIndex = 11;
- this.D13.Value = '3';
- //
- // D14
- //
- this.D14.Dock = System.Windows.Forms.DockStyle.Fill;
- this.D14.LineWidth = 8;
- this.D14.Location = new System.Drawing.Point(445, 3);
- this.D14.Name = "D14";
- this.D14.Size = new System.Drawing.Size(28, 52);
- this.D14.TabIndex = 12;
- this.D14.Value = ':';
- //
- // D15
- //
- this.D15.Dock = System.Windows.Forms.DockStyle.Fill;
- this.D15.LineWidth = 8;
- this.D15.Location = new System.Drawing.Point(479, 3);
- this.D15.Name = "D15";
- this.D15.Size = new System.Drawing.Size(28, 52);
- this.D15.TabIndex = 13;
- this.D15.Value = '0';
- //
- // D16
- //
- this.D16.Dock = System.Windows.Forms.DockStyle.Fill;
- this.D16.LineWidth = 8;
- this.D16.Location = new System.Drawing.Point(513, 3);
- this.D16.Name = "D16";
- this.D16.Size = new System.Drawing.Size(28, 52);
- this.D16.TabIndex = 14;
- this.D16.Value = '1';
- //
- // D17
- //
- this.D17.Dock = System.Windows.Forms.DockStyle.Fill;
- this.D17.LineWidth = 8;
- this.D17.Location = new System.Drawing.Point(547, 3);
- this.D17.Name = "D17";
- this.D17.Size = new System.Drawing.Size(28, 52);
- this.D17.TabIndex = 15;
- this.D17.Value = ':';
- //
- // D18
- //
- this.D18.Dock = System.Windows.Forms.DockStyle.Fill;
- this.D18.LineWidth = 8;
- this.D18.Location = new System.Drawing.Point(581, 3);
- this.D18.Name = "D18";
- this.D18.Size = new System.Drawing.Size(28, 52);
- this.D18.TabIndex = 16;
- this.D18.Value = '5';
- //
- // D19
- //
- this.D19.Dock = System.Windows.Forms.DockStyle.Fill;
- this.D19.LineWidth = 8;
- this.D19.Location = new System.Drawing.Point(615, 3);
- this.D19.Name = "D19";
- this.D19.Size = new System.Drawing.Size(32, 52);
- this.D19.TabIndex = 17;
- this.D19.Value = '3';
- //
- // UCLEDDataTime
- //
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
- this.Controls.Add(this.tableLayoutPanel1);
- this.Name = "UCLEDDataTime";
- this.Size = new System.Drawing.Size(650, 58);
- this.tableLayoutPanel1.ResumeLayout(false);
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
- private UCLEDNum D1;
- private UCLEDNum D2;
- private UCLEDNum D3;
- private UCLEDNum D4;
- private UCLEDNum D5;
- private UCLEDNum D6;
- private UCLEDNum D7;
- private UCLEDNum D8;
- private UCLEDNum D9;
- private UCLEDNum D10;
- private UCLEDNum D12;
- private UCLEDNum D13;
- private UCLEDNum D14;
- private UCLEDNum D15;
- private UCLEDNum D16;
- private UCLEDNum D17;
- private UCLEDNum D18;
- private UCLEDNum D19;
- }
- }

如果你喜欢的话,请到 https://gitee.com/kwwwvagaa/net_winform_custom_control 点个星星吧
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。