How to disable the "Today" line at the bottom of DateTimePicker + Hide WeekEnds [duplicate]
It's all in the question title :-)
I want to get totally rid of the "Today" feature of DateTimePicker
and find a way to "Hide" or gray out WeekEnds.If somebody has hints on how to code such extensions, or on some free downloadable extended DTPickers that could help do this, i'd be very interested.
I know How Customizing Default .net Controls can be a real pain, But I'm a courageous and stout hearted developer and extending the DateTimePicker by overrding WMPAINT, WndProc, and such stuff doesn't scare me anymore :-)
Here is what worked for me as a workaround to avoid weekend, not sure on the today feature,I implemented a check to see which day of the week it was then from the you could choose to notify user to pick another date or warn them.
private void bookingDateDateTimePicker_ValueChanged(object sender, EventArgs e)
{
int x = ((int)DateTime.Parse(bookingDateDateTimePicker.Text).Date.DayOfWeek);
//this will check in the selected date fall son the weekend or not
if ( x>5||x<1)
{
//Reject
MessageBox.Show("Looks like this booked on the weekend, please make sure this is a work day "+x);
}
else
{
//Accept
}
}
精彩评论