由网友(星空)分享简介:我找了一个月选择控制一个.NET 2 WinForm的。I am looking for a month selector control for a .net 2 winform.推荐答案使用DateTimePicker.您可以使用custom格式以便能够指定只月份和年份。 Use DateTimePicke...
我找了一个月选择控制一个.NET 2 WinForm的。
I am looking for a month selector control for a .net 2 winform.
推荐答案
使用DateTimePicker.您可以使用custom格式以便能够指定只月份和年份。
Use DateTimePicker
. You can use a custom format to enable just the month and year to be specified.
例如:
DateTimePicker dateTimePicker1 = new DateTimePicker();
dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat = "MM yyyy";
dateTimePicker1.ShowUpDown = true; // to prevent the calendar from being displayed
请参阅这个MSDN文章了解详情。
编辑:
为prevent被显示的万年历,设置在的DateTimePicker
到将ShowUpDown
属性真
。这将prevent从显示的日历和(同一个 CustomFormat
一起)使您可以通过使用上/下按钮就在月份和年份设置。
To prevent the calendar from being displayed, set the ShowUpDown
property on the DateTimePicker
to true
. This will prevent the calendar from being displayed and (in conjunction with a CustomFormat
) allow you to set just the month and year by using the up/down buttons.
相关推荐
最新文章