如何在日期时间选择器控件中添加复选框? [英] How to add checkbox in datetime picker control ?

查看:553
本文介绍了如何在日期时间选择器控件中添加复选框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI 我想在日期时间选择器控件中添加复选框.
例如,当某人选中复选框当前日期和时间时,时间
将被选中.可能吗 ?如果可以,请帮助我
如何在datetimepicker控件中添加复选框

HI I want to add checkbox in date time picker control.
e.g when someone check the checkbox current date & time
will be selected. Is it possible ? if yes pls help me
how to add checkbox in datetimepicker control

推荐答案

我有一个带有两个DateTimePicker控件的表单. dtpDate的Format属性设置为Long,而dtpTime的Format属性设置为Time,ShowUpDown设置为True.

我创建了一个复选框chkDT,但是您可以为每个控件创建一个复选框.

I have a form with two DateTimePicker controls. dtpDate has the Format property set to Long and dtpTime has the Format property set to Time and ShowUpDown set to True.

I created one check box chkDT but you could create a check box for each control.

Private Sub chkDT_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkDT.CheckedChanged
        If chkDT.Checked = True Then
            dtpDate.Value = Now
            dtpTime.Value = Now
            dtpDate.Enabled = False
            dtpTime.Enabled = False
        Else
            dtpDate.Enabled = True
            dtpTime.Enabled = True
        End If
    End Sub



希望对您有所帮助.



Hope this helps.




System.Windows.Forms.DateTimePicker类具有一个名为"ShowCheckBox"的属性.
如果将此属性设置为true,则DateTimePicker中将有一个复选框.

然后,此复选框将启用或禁用DateTimePicker.

问候
Hi,

the System.Windows.Forms.DateTimePicker class has a property called "ShowCheckBox".
If you set this property to true, then you will have a checkbox inside your DateTimePicker.

This checkBox will then enable or disable the DateTimePicker.

Regards


这篇关于如何在日期时间选择器控件中添加复选框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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