如题...我插入了一个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,按钮能正常显示,但是是灰色不可用的,求高手指点~
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,按钮能正常显示,但是是灰色不可用的,求高手指点~
应该是创建CMFCButton的时候,父窗口指定错了
关联了应该没问题啊.我也是按照你的逻辑试的.挺正常.
能把你COutputWnd类的消息映射项发出来看看不
{
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~!"));
}