开发者

Overriding DateTimePicker Arrow Key Functionality?

I was wondering whether it's possible to override the arrow key functionality that is built into DateTimePickers. For instance, if you select a DateTimePicker and have the month highlighted, if you press up or down, it changes the month up or down.

I want to get rid开发者_如何学Python of all of this and put my own code in there. Any help would be very much appreciated!


Handle the key stroke event for the date picker.

Drop a dateTimePicker on a form. Add a KeyDown event.

The code below essentially disables the arrow keys for the date time picker.

private void dateTimePicker1_KeyDown(object sender, KeyEventArgs e)
{
     e.Handled = true;
}

Not sure what you want to do, but handle the event however you choose and then mark it as handled.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜