首    页 界面/窗口 网络/通讯 数据库 组件开发 图像/多媒体 NET/Web 其它技术 源码下载 资料下载 软件共享 软件外包 曲艺杂谈
栏目导航:  首    页  |  界面/窗口  |  其它控件   


关于DateTimePicker控件Show None属性的问题


原作者:施昌权    源出处:卓为VC    发布者:施昌权    发布类型:原创    发布日期:2008-08-22


        利用Show None属性可以设置是否选择日期,内含一个CheckBox,使用CheckBox 属性能够指定控件是否返回日期。缺省情况下,CheckBox  的值为False,并且控件总是返回一个日期。如果CheckBox属性设为True,那么在控件日期和时间左边的编辑部分中将出现一个小的复选框。如果这个复选框没有被选中,那么Value属性返回一个空值。如果选中了这个复选框,那么控件通过Value属性返回当前显示日期。   

可以通过以下方式获得CheckBox是否选中的状态:
CString strYear  = _T("");
CString strMonth = _T("");
CString strDay   = _T("");
        CTime timeTime;   
DWORD   dwResult   =   m_ctrValidTime.GetTime(timeTime);
if   (dwResult   ==   GDT_VALID)  
        {  
                strYear.Format("%d", timeTime.GetYear());
                strMonth.Format("%d", timeTime.GetMonth());
                strDay.Format("%d", timeTime.GetDay());
                strYear = strYear.Right(2);
                if ( strMonth.GetLength() == 1 )
                {
                        strMonth = _T("0") + strMonth;
                }
                if ( strDay.GetLength() == 1 )
                {
                        strDay = _T("0") + strDay;
                }
                m_strValidTime = strYear + strMonth + strDay;  
                m_strValidTime.TrimLeft();
                m_strValidTime.TrimRight();   
                AfxMessageBox("你选中了checkbox时间是" + strValidTime );  
        }  
        else  
        {  
                AfxMessageBox(_T("你没有选中了checkbox!"));  
        }   


关于我们 版权声明 广告服务 联系我们 友情链接 加入收藏
站长:施昌权    Email:scq2099yt@163.com    MSN:scq2099yt@live.cn    QQ:14046300    本站QQ群:67202409
Copyright © 2008     卓为VC(www.joyvc.cn)    All Rights Reserved    建议分辨率 1024×768
本站由施昌权制作维护
京ICP备09012297号