关于VC2008设置对话框背景颜色

本文讨论了在VC2008中WM_CTLCOLORDLG消息的处理方法,包括如何在WinnApp中设置对话框背景颜色,并详细解释了在每个对话框中对WM_CTLCOLORDLG消息处理的手工消息映射过程。重点在于解决不支持原函数的问题,提供了一种替代方案。

关于WM_CTLCOLORDLG消息的处理,用来设置对话框的背景颜色,一般采用在WinnApp中使用void SetDialogBkColor( COLORREF clrCtlBk = RGB(192, 192, 192), COLORREF clrCtlText = RGB(0, 0, 0) )实现,可是在VC2008中已经不支持这个函数,而采用在每个对话框中对WM_CTLCOLORDLG消息处理,但是实现起来非常有讲究。必须手工进行消息映射。

 

在VC6.0 MSDN中的关于WM_CTLCOLORDLG消息的描述如下:

WM_CTLCOLORDLG

The WM_CTLCOLORDLG message is sent to a dialog box before the system draws the dialog box. By responding to this message, the dialog box can set its text and background colors by using the given display device context handle.

WM_CTLCOLORDLG hdcDlg = (HDC) wParam; // handle of dialog box display context hwndDlg = (HWND) lParam; // handle of dialog box  
Parameters
hdcDlg
Value of wParam. Identifies the device context for the dialog box.
hwndDlg
Value of lParam. Identifies the dialog box.
Return Values

If an application processes this message, it must return the handle of a brush. The system uses the brush to paint the background of the dialog box.

转载于:https://www.cnblogs.com/ShlodenZhang/archive/2013/05/17/3083106.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值