读书人

关于winform上实现dateTimePicker自动

发布时间: 2013-03-26 09:54:34 作者: rapoo

关于winform上实现dateTimePicker自动更新的问题
pannel上放一个checkbox指示是否采用系统时间,并且定义一个计时器和一个dateTimepicker,问题是
dateTimepicker的值只有秒在跳动,分钟从来不变,求解。。。。。



private void checkBox9_CheckedChanged(object sender, EventArgs e)
{
CheckBox checkBox = sender as CheckBox;
if (checkBox.Checked)
{
this.dateTimePicker25.Enabled = false;
this.timer1.Start();
}
else
{
this.dateTimePicker25.Enabled = true;
this.timer1.Stop();
}
}

private void timer1_Tick(object sender, EventArgs e)
{
this.dateTimePicker25.Value = DateTime.Now;
}




[解决办法]
我测试没问题,你咋写的

读书人网 >.NET

热点推荐