private void timer1_Tick(object sender, EventArgs e)
{
string dateHousr = DateTime.Now.TimeOfDay.Hours.ToString();
string dateMuidte=DateTime.Now.TimeOfDay.Minutes.ToString();
string strsecone=DateTime.Now.TimeOfDay.Seconds.ToString();
if (Convert.ToInt32(dateHousr) < 10)
{
dateHousr = "0" + dateHousr;//Convert.ToInt32(
}
if (Convert.ToInt32(dateMuidte) < 10)
{
dateMuidte = "0" + dateMuidte;
}
if (Convert.ToInt32(strsecone) < 10)
{
strsecone = "0" + strsecone;
}
this.toolStripStatusLabel3.Text = "
系统时间:" + dateHousr + ":" + dateMuidte + ":" + strsecone;
}
这部分代码可以实现,你试试看。(主要代码)