解决方案 »

  1.   

    checkbox实际上是button,只有owner-draw的button才会给parent发WM_CTLCOLOR
      

  2.   

    There are three solutions:1) Disable theme for you checkbox using SetWindowTheme function. Then handle WM_CTLCOLORSTATIC message and change color using SetTextColor.2) Use ownerdrawing. Set BS_OWNERDRAW style, as you already knew, to your checkbox. Then handle WM_DRAWITEM message and draw checkbox by yourself. DrawThemeBackground can help to draw themed checkbox.3) Use customdraw. Handle NM_CUSTOMDRAW notify and draw checkbox on CDDS_PREPAINT stage.http://social.msdn.microsoft.com/Forums/zh-CN/cd6e7637-3550-4d1c-9b11-4f0f0965675f/change-checkbox-text-color-win32?forum=vcgeneral
      

  3.   

    http://stackoverflow.com/questions/15214237/checkbox-change-the-text-color
      

  4.   

    CCheckListBox::DrawItem
    virtual void DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct );ParameterslpDrawItemStructA long pointer to a DRAWITEMSTRUCT structure that contains information about the type of drawing required.ResCalled by the framework when a visual aspect of an owner-drawn checklist box changes. The itemAction and itemState members of the DRAWITEMSTRUCT structure define the drawing action that is to be performed. By default, this function draws a default checkbox list, consisting of a list of strings each with a default-sized checkbox to the left. The checkbox list size is the one specified in Create.Override this member function to implement drawing of owner-draw checklist boxes that are not the default, such as checklist boxes with lists that aren't strings, with variable-height items, or with checkboxes that aren't on the left. The application should restore all graphics device interface (GDI) objects selected for the display context supplied in lpDrawItemStruct before the termination of this member function.If checklist box items are not all the same height, the checklist box style (specified in Create) must be LBS_OWNERVARIABLE, and you must override the MeasureItem function.CCheckListBox Overview |  Class Members |  Hierarchy ChartSee Also   CCheckListBox::Create, CCheckListBox::MeasureItem
      

  5.   

    感谢ldle_、 Trueman_onlyme、 赵老师。 不过由于赶时间,我贴了个static上去假装checkbox,看起来视觉效果差不多,在重载下onLButtonDown,模拟下选中和取消状态。
    我找时间 自绘下,用过自绘checkbox的ctlcolor,不过由于背景问题放弃了。我再试试drawitem或onpaint谢谢!