vc 中添加 时间控件,尤其是小时分钟控件
2010-06-04 09:49
555 查看
Project -》Add to Project
插入 Microsoft Date and Time Picker Control 控件
然后 Controls里面就会多出一个控件来,
拉一个到对话框中, 其ID为 IDC_DATETIMEPICKER1
然后设置其格式。。。
下面是参考的
http://topic.csdn.net/u/20080315/12/AE6C4745-AF7B-4BBD-AA9F-D6F299DA2367.html
=========================
没有必要去insert 额外的控件,
vC自带的标准控件 date time picker 就足够了。
Example
void CDatesDlg::OnButton2()
{
// Gain a pointer to the control
CDateTimeCtrl* pCtrl = (CDateTimeCtrl*) GetDlgItem(IDC_DATETIMEPICKER1);
ASSERT(pCtrl != NULL);
// The control will create itself with a format that matches the
// locale setting in Control Panel. But we can force a particular
// format with a call to SetFormat(). This call forces the format
// dd-MMM-yy, which would show 03-APR-98 for April 3rd, 1998.
pCtrl->SetFormat(_T("dd-MMM-yy hh:mm"));
}
Element Description
"d" The one- or two-digit day.
"dd" The two-digit day. Single-digit day values are preceded by a zero.
"ddd" The three-character weekday abbreviation.
"dddd" The full weekday name.
"h" The one- or two-digit hour in 12-hour format.
"hh" The two-digit hour in 12-hour format. Single-digit values are preceded by a zero.
"H" The one- or two-digit hour in 24-hour format.
"HH" The two-digit hour in 24-hour format. Single-digit values are preceded by a zero.
"m" The one- or two-digit minute.
"mm" The two-digit minute. Single-digit values are preceded by a zero.
"M" The one- or two-digit month number.
"MM" The two-digit month number. Single-digit values are preceded by a zero.
"MMM" The three-character month abbreviation.
"MMMM" The full month name.
"t" The one-letter AM/PM abbreviation (that is, AM is displayed as "A").
"tt" The two-letter AM/PM abbreviation (that is, AM is displayed as "AM").
"yy" The last two digits of the year (that is, 1996 would be displayed as "96").
"yyyy" The full year (that is, 1996 would be displayed as "1996").
插入 Microsoft Date and Time Picker Control 控件
然后 Controls里面就会多出一个控件来,
拉一个到对话框中, 其ID为 IDC_DATETIMEPICKER1
然后设置其格式。。。
下面是参考的
http://topic.csdn.net/u/20080315/12/AE6C4745-AF7B-4BBD-AA9F-D6F299DA2367.html
=========================
没有必要去insert 额外的控件,
vC自带的标准控件 date time picker 就足够了。
Example
void CDatesDlg::OnButton2()
{
// Gain a pointer to the control
CDateTimeCtrl* pCtrl = (CDateTimeCtrl*) GetDlgItem(IDC_DATETIMEPICKER1);
ASSERT(pCtrl != NULL);
// The control will create itself with a format that matches the
// locale setting in Control Panel. But we can force a particular
// format with a call to SetFormat(). This call forces the format
// dd-MMM-yy, which would show 03-APR-98 for April 3rd, 1998.
pCtrl->SetFormat(_T("dd-MMM-yy hh:mm"));
}
Element Description
"d" The one- or two-digit day.
"dd" The two-digit day. Single-digit day values are preceded by a zero.
"ddd" The three-character weekday abbreviation.
"dddd" The full weekday name.
"h" The one- or two-digit hour in 12-hour format.
"hh" The two-digit hour in 12-hour format. Single-digit values are preceded by a zero.
"H" The one- or two-digit hour in 24-hour format.
"HH" The two-digit hour in 24-hour format. Single-digit values are preceded by a zero.
"m" The one- or two-digit minute.
"mm" The two-digit minute. Single-digit values are preceded by a zero.
"M" The one- or two-digit month number.
"MM" The two-digit month number. Single-digit values are preceded by a zero.
"MMM" The three-character month abbreviation.
"MMMM" The full month name.
"t" The one-letter AM/PM abbreviation (that is, AM is displayed as "A").
"tt" The two-letter AM/PM abbreviation (that is, AM is displayed as "AM").
"yy" The last two digits of the year (that is, 1996 would be displayed as "96").
"yyyy" The full year (that is, 1996 would be displayed as "1996").
相关文章推荐
- dateTimePicker选择时间控件(选择日期, 小时分钟秒)
- [转]dateTimePicker选择时间控件(选择日期, 小时分钟秒)
- 支持小时和分钟选择的时间控件For ASP.Net【转载】
- winform dateTimePicker选择时间控件-选择小时、分钟、秒
- Js Jquery 时间控件显示小时 分钟 秒
- VC为按钮控件添加图片的方法
- VC++实现工具栏上添加平面组合框控件
- 针对时间戳获取指定的小时分钟秒数
- VC2008 PictureControl(图片控件)添加注意问题
- VC中添加web控件的方法
- sql 获取 时间 小时 分钟 秒
- VC为按钮控件添加图片
- (VC2005)MFC中添加控件的成员变量.
- js获取当前时间;时间戳转换;前n小时的时间;前n分钟的时候
- iOS 前端与后台服务器时间差的计算并转化为天、小时、分钟
- VC 为静态控件添加事件
- Java时间工具类DateUtils(把日期时间转换成xx秒前、xx分钟前、xx小时前...)
- 在VC中添加控件的包装类
- PHP人性化时间显示,实现多少秒前,多少分钟前,多少小时前
- java计算两个时间相差(天、小时、分钟、秒)