如题...我插入了一个cmfcbutton m_Button
int COutputWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
......
m_Button.Create(_T("asdf"),WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,CRect (0,0,40,40),this,ID_WEBCONTROL_GAS);
m_Button.SetTooltip(_T("Test ToolTip")); CToolTipCtrl &toolTip=m_Button.GetToolTipCtrl(); toolTip.SetDelayTime(0);
......
}
ID_WEBCONTROL_GAS是我定义的响应函数,ON_BN_CLICKED,按钮能正常显示,但是是灰色不可用的,求高手指点~

解决方案 »

  1.   

    m_Button.Create(_T("asdf"),WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,CRect (0,0,40,40),this,ID_WEBCONTROL_GAS);
    应该是创建CMFCButton的时候,父窗口指定错了
      

  2.   

    应该还有什么其它的窗口也在CDockablePane上面
      

  3.   

    但是确实是显示了的,只是灰色的, this确实是指向cdocpane的。
      

  4.   

    id要关联消息处理函数。 关联了就好了。 很easy
      

  5.   

    已经关联了,ID_WEBCONTROL_GAS和我定义的响应函数onwebcontrolgas关联了
      

  6.   


    关联了应该没问题啊.我也是按照你的逻辑试的.挺正常.
    能把你COutputWnd类的消息映射项发出来看看不
      

  7.   

    class COutputWnd : public CDockablePane
    {
    CMFCButton *m_Button;
    .....
    afx_msg void OnButtonGas(void);
    DECLARE_MESSAGE_MAP()
    }BEGIN_MESSAGE_MAP(COutputWnd, CDockablePane)
    ON_COMMAND(ID_WEBCONTROL_GAS, &COutputWnd::OnWebcontrolGas)
    END_MESSAGE_MAP()void COutputWnd::OnWebcontrolGas()
    {
    // TODO: Add your command handler code here
    AfxMessageBox(_T("hello~!"));
    }