Is it possible to resize a DateTimePicker or MonthCalendar Control in VB.net

早过忘川 提交于 2020-01-05 10:18:20

问题


Essentially I want to re-size my dateTimePicker control to fit its parent container. I have tried to do this both through the Control Editor and programmatically but I simply cannot get the drop down calendar to expand at all. So 2 part question:

a) Is this even possible to do?

b) Is there an easy-to-implement solution to having a good looking calendar that fits its parent field? (i.e. using a data grid or something similar)

Any help or knowledge is greatly appreciated!!!


回答1:


The size of both objects is fixed and defined by the size of its font. Thus you might change its size by affecting the font size. This works fine with DateTimePicker but does not seem to work with MonthCalendar. After a quick research I have found a pretty curious recommendation on the MSDN forum: "you can consider third party MonthCalendar controls to meet your requirement temporarily".

There are quite a few third-party options (after a really quick search I found this) or you might even create one by your own. I personally haven't ever had any problem with the in-built controls but if the size is so important for you I guess that you would have to search/develop something by your own.

Further recommendation: rely on WPF which does contain a resizable control (DatePicker). I want to highlight here that I don't like WPF at all and that thus this recommendation is because I don't see any other option (inside .NET).



来源:https://stackoverflow.com/questions/17556698/is-it-possible-to-resize-a-datetimepicker-or-monthcalendar-control-in-vb-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!