在Win32中对MonthCal控件进行子类化

时间:2022-02-27 00:02:17

Objective: use the standard Win32 MonthCal control, and paint days such as holidays in RED.

目标:使用标准的Win32 MonthCal控件,并在RED中绘制假期等天数。

It seems like the Win32's native approach would be use the MCN_GETDAYSTATE notification, which seems to allow only painting specific days in Bold.

似乎Win32的原生方法将使用MCN_GETDAYSTATE通知,这似乎只允许在Bold中绘制特定日期。

Possible (but declined) solution would be to write my own painted-at-will MonthCalendar, driving myself right out of the theme support - meaning that chances are my control will not be UI consistent when newer themes are out there.

可能(但是拒绝)的解决方案是编写我自己的随意绘制MonthCalendar,将自己推出主题支持 - 这意味着当新的主题出现时,我的控制机会不会与UI保持一致。

If anyone have come across this issue, a solution would be much appreciated.

如果有人遇到过这个问题,我们将非常感谢您提供解决方案。

2 个解决方案

#1


1  

Well if your application doesn't use any MFC, but is written in pure win32 calls, an MFC control to do what you want is out of the question. So you can make a control with MFC or with win32 - obviously the MFC control will use win32 under the hood but 15 years of Windows developer convention says that when someone talks about a 'win32 control', it's a control that 'only uses win32 calls, no external libraries' and an 'MFC control' is 'a control that directly or indirectly derives from CWnd and uses the MFC classes and usage patterns'.

好吧,如果您的应用程序不使用任何MFC,但是使用纯win32调用编写,那么MFC控件可以执行您想要的操作是不可能的。所以你可以使用MFC或win32进行控制 - 显然MFC控件将使用win32,但15年的Windows开发人员约定说,当有人谈到'win32控件'时,它是一个'只使用win32调用'的控件,没有外部库和'MFC控件'是'直接或间接从CWnd派生并使用MFC类和使用模式的控件'。

Anyway, look at http://www.bcgsoft.com/samples/calendar.htm. They have a control in their UI suite that looks like the MonthCal control, but where you can indicate date ranges etc. with colors.

无论如何,请查看http://www.bcgsoft.com/samples/calendar.htm。他们的UI套件中有一个看起来像MonthCal控件的控件,但是你可以用颜色指示日期范围等。

#2


0  

Can't be done. That control only supports showing some days in bold.

无法做到。该控件仅支持以粗体显示某些天。

What platform are you targeting (desktop or WM?) If desktop, is it really win32 or is an MFC solution acceptable?

你在什么平台上定位(桌面或WM?)如果桌面,它真的是win32还是MFC解决方案可以接受?

#1


1  

Well if your application doesn't use any MFC, but is written in pure win32 calls, an MFC control to do what you want is out of the question. So you can make a control with MFC or with win32 - obviously the MFC control will use win32 under the hood but 15 years of Windows developer convention says that when someone talks about a 'win32 control', it's a control that 'only uses win32 calls, no external libraries' and an 'MFC control' is 'a control that directly or indirectly derives from CWnd and uses the MFC classes and usage patterns'.

好吧,如果您的应用程序不使用任何MFC,但是使用纯win32调用编写,那么MFC控件可以执行您想要的操作是不可能的。所以你可以使用MFC或win32进行控制 - 显然MFC控件将使用win32,但15年的Windows开发人员约定说,当有人谈到'win32控件'时,它是一个'只使用win32调用'的控件,没有外部库和'MFC控件'是'直接或间接从CWnd派生并使用MFC类和使用模式的控件'。

Anyway, look at http://www.bcgsoft.com/samples/calendar.htm. They have a control in their UI suite that looks like the MonthCal control, but where you can indicate date ranges etc. with colors.

无论如何,请查看http://www.bcgsoft.com/samples/calendar.htm。他们的UI套件中有一个看起来像MonthCal控件的控件,但是你可以用颜色指示日期范围等。

#2


0  

Can't be done. That control only supports showing some days in bold.

无法做到。该控件仅支持以粗体显示某些天。

What platform are you targeting (desktop or WM?) If desktop, is it really win32 or is an MFC solution acceptable?

你在什么平台上定位(桌面或WM?)如果桌面,它真的是win32还是MFC解决方案可以接受?