该控件继承 Control 基类开发的。
数字时间的格式有 时、时分、时分秒、时分秒毫秒 4种。各个部分可以设置成独立的颜色。
事件由数字符号组成,以下是数字原理,数字可分为7笔,如下
1 private void draw_vertical_11(Graphics g, Pen pen, RectangleF bounds_rect) 2 { 3 float x1 = bounds_rect.X + this.cap_c; 4 float y1 = bounds_rect.Y + this.LineWidth + 1; 5 float x2 = bounds_rect.X + this.cap_c; 6 float y2 = bounds_rect.Y + this.line_h + 1; 7 g.DrawLine(pen, x1, y1, x2, y2); 8 } 9 private void draw_vertical_21(Graphics g, Pen pen, RectangleF bounds_rect) 10 { 11 float x1 = bounds_rect.X + this.cap_c; 12 float y1 = bounds_rect.Y + this.LineWidth + this.line_h + 3; 13 float x2 = bounds_rect.X + this.cap_c; 14 float y2 = bounds_rect.Y + this.line_h + this.line_h + 3; 15 g.DrawLine(pen, x1, y1, x2, y2); 16 } 17 18 private void draw_horizontal_1(Graphics g, Pen pen, RectangleF bounds_rect) 19 { 20 float x1 = 1 + bounds_rect.X + this.LineWidth; 21 float y1 = bounds_rect.Y + this.cap_c; 22 float x2 = 1 + bounds_rect.X + this.line_w; 23 float y2 = bounds_rect.Y + this.cap_c; 24 g.DrawLine(pen, x1, y1, x2, y2); 25 } 26 private void draw_horizontal_2(Graphics g, Pen pen, RectangleF bounds_rect) 27 { 28 float x1 = 1 + bounds_rect.X + this.LineWidth; 29 float y1 = 2 + bounds_rect.Y + this.cap_c + this.line_h; 30 float x2 = 1 + bounds_rect.X + this.line_w; 31 float y2 = 2 + bounds_rect.Y + this.cap_c + this.line_h; 32 g.DrawLine(pen, x1, y1, x2, y2); 33 } 34 private void draw_horizontal_3(Graphics g, Pen pen, RectangleF bounds_rect) 35 { 36 float x1 = 1 + bounds_rect.X + this.LineWidth; 37 float y1 = 4 + bounds_rect.Y + this.cap_c + this.line_h + this.line_h; 38 float x2 = 1 + bounds_rect.X + this.line_w; 39 float y2 = 4 + bounds_rect.Y + this.cap_c + this.line_h + this.line_h; 40 g.DrawLine(pen, x1, y1, x2, y2); 41 } 42 43 private void draw_vertical_12(Graphics g, Pen pen, RectangleF bounds_rect) 44 { 45 float x1 = bounds_rect.X + this.cap_c + 2 + this.line_w; 46 float y1 = bounds_rect.Y + this.LineWidth + 1; 47 float x2 = bounds_rect.X + this.cap_c + 2 + this.line_w; 48 float y2 = bounds_rect.Y + this.line_h + 1; 49 g.DrawLine(pen, x1, y1, x2, y2); 50 } 51 private void draw_vertical_22(Graphics g, Pen pen, RectangleF bounds_rect) 52 { 53 float x1 = bounds_rect.X + this.cap_c + 2 + this.line_w; 54 float y1 = bounds_rect.Y + this.LineWidth + this.line_h + +3; 55 float x2 = bounds_rect.X + this.cap_c + 2 + this.line_w; 56 float y2 = bounds_rect.Y + this.line_h + this.line_h + 3; 57 g.DrawLine(pen, x1, y1, x2, y2); 58 }