说明为什么Button控件不能使用CustomDraw技术

MFC 4.7版本后实现了CustomDraw技术,使得对许多普通控件的自绘变得非常灵活和简单,我们通过修改传入的结构体成员来对控件做细微的定制,对于不关心的绘制阶段我们不做任何处理;CustomDraw自绘技术不同于OwnerDraw技术技术,OwnerDraw要求程序员员去绘制控件的整个阶段

CustomDraw技术仅支持以下这些:

Header controls
List-view controls
Rebar controls 
Toolbar controls 
ToolTip controls 
Trackbar controls 
Tree-view controls


对应Button控件在特殊条件下也能使用,MSDN原文使用条件说明如下:

Custom draw is also supported for button controls if you are running Windows XP and have an application manifest to ensure that Comctl32.dll version 6 is available.


目前Windows XP系统微软已经不维护了,退出历史舞台了,我的电脑系统是Wind7的,因此使用CustomDraw技术完成Button控件的自绘是行不通的,只能使用Owner Draw自绘技术。为了兼容老代码,不可能取消Owner Draw,因此Custom Draw也没有必要支持Button, Static的简单控件。

MFC Button控件自绘,参考MFC自绘Button按钮分析和实现.

posted @ 2016-12-18 19:34  小怪兽&奥特曼  阅读(213)  评论(0)    收藏  举报