我要展示一个数字钟。 这里,我不得不在24小时格式的正文中显示时间,我知道如何转换到12小时。
DispatcherTimer timerdigital;
public MainWindow()
{
this.InitializeComponent();
//StartTimer(null, null);
timerdigital = new DispatcherTimer();
timerdigital.Interval = TimeSpan.FromSeconds(1.0);
timerdigital.Start();
timerdigital.Tick += new EventHandler(delegate(object s, EventArgs a)
{
tbDigital.Text = "" + DateTime.Now.Hour + ":"
+ DateTime.Now.Minute + ":"
+ DateTime.Now.Second;
});
感谢