在C#赢形式的DateTimePicker限制的日期 [英] Limiting the dates within a C# win form DateTimePicker
本文介绍了在C#赢形式的DateTimePicker限制的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可能限制其历史,用户可以从的DateTimePicker
在C#的WinForms应用程序中选择?
Is it possible to limit which dates a user can select from a dateTimePicker
on a C# winforms application?
我的基本原理是这样的:我有一个组合框
有5个项目在它的基础上,该项目的用户选择,我想限制其历史的用户然后可以选择,具有不可用的日期显示为灰色。
The basic principle for me is this: I have a comboBox
with 5 items in it, based on which item the user selects I would like to limit which dates the user can then select from, having the unavailable dates grayed out.
这可能吗?
推荐答案
Use the MinDate
and MaxDate
properties.
dateTimePicker.MinDate = DateTime.Now;
dateTimePicker.MaxDate = DateTime.Now.AddDays(15);
(渲染在法国的Windows 7)
(render on a french Windows 7)
这篇关于在C#赢形式的DateTimePicker限制的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文