找了月/年选择器控制。NET的WinForm [英] looking for a month/year selector control for .net winform
问题描述
我找了一个月选择控制一个.NET 2 WinForm的。
I am looking for a month selector control for a .net 2 winform.
推荐答案
使用<一个href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datetimepicker.aspx"><$c$c>DateTimePicker$c$c>.您可以使用<一个href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datetimepicker.customformat.aspx">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.
这篇关于找了月/年选择器控制。NET的WinForm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!