更新时钟 [英] Update-Clock

查看:108
本文介绍了更新时钟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨;
我使用了MFC ToolBox中的时间选择器.
您能建议我如何按当前时间更新时间吗? (像一个真正的时钟)?

谢谢
Sb

Hi;
I used the time picker from MFC ToolBox.
Would you suggest me how Can I update the time by current time? (like a real clock)?

Thank you;
Sb

推荐答案

//我只需要在Dialog窗口上有一个时钟即可.

我会建议的,
使用静态文本框(例如,ID为IDC_YOURCLOCK),

其内容将被设置(GetDlgItem(IDC_YOURCLOCK)->SetWindowText(..))
通过对话框的计时器反应中的格式化字符串.

您还可以在该框中设置任何样式和字体,
对于用户来说,它将保留为只读"时钟...:)
// I just need to have a clock on the Dialog window.

It will be suggested (by me),
to use a static text box (for example with ID: IDC_YOURCLOCK),

whose content will be set (GetDlgItem(IDC_YOURCLOCK)->SetWindowText(..))
by the formatted strings from the timer reaction of your dialog.

You could also set any styles and fonts at that box,
and it will stay as a "read only" clock for the users... :)


您的TimePicker应该具有一个名为Time(或DateTime)的属性.当您想更新控件(也许在计时器上)时,只需将该属性设置为当前时间/日期时间即可. (可能有一个SetTime或类似的方法.)确保刷新控件或其中的某个容器.
Your TimePicker should have a property called Time (or maybe DateTime). When you want to update the control (maybe on a timer), just set that property to the current time/datetime. (There is probably a SetTime or some such method.) Make sure the control or some container of it is refreshed.


我只需要在Dialog窗口上有一个时钟即可.
正确的是,我从工具箱添加了TimePicker.现在,我可以在启动应用程序的任何时间坐下来.我想自动更新.
感谢您的帮助.

SB
I just neen to have a clock on the Dialog window.
Right mow I add TimePicker from ToolBox. What I have now is sit at whatever time when I start the application. I want to update it automatically.
Thanks for help.

Sb


这篇关于更新时钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆