_timer.Tick += new EventHandler(TimerOnTick);
_timer.Interval = 1000;
_timer.Enabled = true;
}
}
else
{
if(this._timer != null)
{
_timer.Enabled = false;
}
}
this._isTimerEnable = value;
}
}
public void Start()
{
this.IsTimerEnable = true;
this.Refresh();
}
public void Stop()
{
this.IsTimerEnable = false;
}
public System.DateTime DateTime
{
get { return this._dateTime; }
set { this._dateTime = value; }
}
//LED文字的颜色
public System.Drawing.Color ClockColor
{
get { return this._clockColor; }
set
{
this._clockColor = value;
this.Invalidate();
}
}
public SevenSegmentClockStyle SevenSegmentClockStyle
{
get { return this._clockStyle; }
set
{
this._clockStyle = value;
this.Invalidate();
}
}
public SevenSegmentClock()
{
Text = "Seven-Segment Clock";
//使用双缓冲,支持透明绘制
SetStyle(ControlStyles.UserPaint | ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint
| ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true);
this.UpdateStyles();
Init();
_dateTime = DateTime.Now;
}
//初始化
private void Init()
{
m_Bitmap = new Bitmap(this.Width, this.Height);
g = Graphics.FromImage(m_Bitmap);
g.CompositingQuality = CompositingQuality.HighQuality;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
//g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.SmoothingMode = SmoothingMode.HighQuality;
//g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
}
| 对此文章发表了评论 |

