灰色显示/禁用Windows窗体中日期时间选择器中当前日期之前的日期 [英] Grey out/ Disable the date before Current Date in Date time picker in windows forms

查看:173
本文介绍了灰色显示/禁用Windows窗体中日期时间选择器中当前日期之前的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Experts,



我正在寻找类似的东西。我想禁用/灰显我的表格中当前日期之前的日期时间选择器中的所有日期。

我尝试了以下代码。并且它不会禁用它只显示空白空间,这是我不想要的。我实际上想把日期变灰。

Hello Experts,

I was looking for something like. I want to Disable / Grey out all the Dates in Date time picker in my Form that are before Current Date.
I tried the below code. And It doesn't disable instead it just show empty white space which is what I don't want. I actually want to grey out the dates.

dtStart.MinDate = Today





所有Google搜索都指示我使用某些第三方控件,由于某些原因我无法在项目中使用它们。有没有什么方法可以在当前日期(今天的日期)之前灰显/禁用日期



All the google Searches directed me to some third party controls which I cannot use them in project for some reason. Is there any way that I can grey out/ disable the dates before Current Date(Today's Date)

推荐答案

DateTimePicker.MinDate Property

< a href =https://msdn.microsoft.com/en-us/library/system.windows.forms.datetimepicker.mindate(v=vs.110).aspx> https://msdn.microsoft.com/ en-us / library / system.windows.forms.datetimepicker.mindate(v = vs.110).aspx [ ^ ]
DateTimePicker.MinDate Property
https://msdn.microsoft.com/en-us/library/system.windows.forms.datetimepicker.mindate(v=vs.110).aspx[^]


你有别无选择,只能制作自己的控件版本并提供自己渲染的代码。



我见过的所有DatePicker控件都没有显示超出MinDate和MaxDate值的任何内容。
You have no choice but to make your own version of the control and provide the code to render it yourself.

All of the DatePicker controls I've ever seen don't show anything beyond the MinDate and MaxDate values.


这篇关于灰色显示/禁用Windows窗体中日期时间选择器中当前日期之前的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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