找了月/年选择器控制。NET的WinForm [英] looking for a month/year selector control for .net winform

查看:342
本文介绍了找了月/年选择器控制。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.您可以使用<一个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屋!

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