我怎样才能改变特定日期的MonthCalendar控件的颜色? [英] How can I change the color of certain dates in the MonthCalendar control?

查看:2588
本文介绍了我怎样才能改变特定日期的MonthCalendar控件的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能改变特定日期的颜色MonthCalendar控件在VB.NET?

How can I change the color of certain dates in the MonthCalendar control in VB.NET?

例如,我需要改变1月21日的颜色为红色,周日橙等等...

For example, I need to change the color of Jan 21 to Red, Sundays to Orange and so on...

推荐答案

这是不可能的。有定制的方式,个别天或日期显示在没有内置的方式的MonthCalendar 控制。

This is not possible. There is no built-in way of customizing the way that individual days or dates are displayed on the MonthCalendar control.

您的可以的所有者绘制控件,但这是太多的工作来证明。这会让你负责绘制整个控制自己。请注意,如果你选择走这条路,在的MonthCalendar 控制不提高油漆事件,因为该基地控制集在 UserPaint 位为假。你将不得不继承控制并覆盖其<一个href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.onprint.aspx"><$c$c>OnPrint方法代替。

You could owner-draw the control, but that's way too much work to justify. This will make you responsible for drawing the entire control yourself. Note that if you choose to go this route, the MonthCalendar control does not raise the Paint event because the base control sets the UserPaint bit to "False". You will have to subclass the control and override its OnPrint method instead.

我不能亲自推荐任何第三方控件,提供定制化的这个水平,但快速谷歌搜索确实出现转了几个选项:

I can't personally recommend any third-party controls that provide this level of customization, but a quick Google search does appear to turn up a few options:

  • Another Month Calendar
  • Customizable MonthCalendar Type Control
  • MonthCalendar Calendar - Control

这篇关于我怎样才能改变特定日期的MonthCalendar控件的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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