不用控件,直接在回调函数里拦截消息。

解决方案 »

  1.   

    不明白你的意思.wm_drawitem直接在窗口函数里就可以处理的.
      

  2.   

    在主窗口里
    switch (message)
    {
    case WM_DRAWITEM:
    }
    就可以了啊~~
      

  3.   

    在windows主窗口回调里拦截不到此消息,怎么处理呀。谢谢捧场
      

  4.   

    The WM_DRAWITEM message is sent to the owner window of an owner-drawn button, combo box, list box, or menu when a visual aspect of the button, combo box, list box, or menu has changed
      

  5.   

    设置控件的ownerdraw样式。
    myButton.Create(_T("My button"), 
          WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON|BS_OWNERDRAW,  //BS_OWNERDRAW
          CRect(10,10,100,30), pParentWnd, 1);pmyListBox->Create(
          WS_CHILD|WS_VISIBLE|WS_BORDER|WS_HSCROLL|WS_VSCROLL|
          LBS_SORT|LBS_MULTIPLESEL|LBS_OWNERDRAWVARIABLE,    //LBS_OWNERDRAWVARIABLE
          myRect, pParentWnd, 1);其他支持控件也要有这个样式。
      

  6.   

    不用控件,怎么得到WM_DRAWITEM?
    The WM_DRAWITEM message is sent to the owner window of an owner-drawn button, combo box, list box, or menu when a visual aspect of the button, combo box, list box, or menu has changed
      

  7.   

    并不是控件编程,请问大虾,如何设置menu自己的回调函数,调用函数SetWindowLong()失败,他只能改变主窗口的回调函数。应该怎么操作?
      

  8.   

    菜单也得设置自画风格才能给父窗口关生wm_drawitem消息.当然,直接子类化menu的那个窗口也是可以的,不过你是用来做平面菜单用的,你只是想自画的话,用ModifyMenu给菜单项加上MF_OWNERDRAW风格就OK了
      

  9.   

    谢谢 _foo(void)            //莫名函数:) 
    请问我如何设置菜单自画风格。
      

  10.   

    用ModifyMenu给菜单项加上MF_OWNERDRAW风格就OK了
      

  11.   

    非常感谢_foo(void)            //莫名函数:)
    已经可以了!!!:)