CDockablePane上的按钮被禁用。为什么? [英] Button is disabled on CDockablePane. Why?

查看:152
本文介绍了CDockablePane上的按钮被禁用。为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我在窗口上有一个CDockablePane,我正在尝试添加一个按钮。但是按钮总是有WS_DISABLED样式集(用SPY ++找到)并且无法删除。

请参阅下面的源代码:

我有一个可停靠面板的基类:

Hello,

I have a CDockablePane on a window and I am trying to add a button on it. However the button always have the WS_DISABLED style set (found this with SPY++) and it cannot be removed.

See below the source code:

I have a base class for dockable panels:

#pragma once
#include" afxdockablepane.h"
class CDockPanelBase: public CDockablePane
{
public
CDockPanelBase( void );
~CDockPanelBase( void );
virtual void AdjustLayout()= 0;
virtual void 更新( int param = 0)= 0;
virtual void CreateLayout()= 0;
protected
virtual BOOL CanFloat() const ;
virtual BOOL CanBeClosed() const ;
virtual < font style ="font-size:11px"> BOOL CanAutoHide() const ;
virtual BOOL CanAcceptPane( const CBasePane * pBar) const ;
afx_msg < font style ="color:blue"> int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
DECLARE_MESSAGE_MAP( )
CFont * GetStaticFont() ;
};
#pragma once 
#include "afxdockablepane.h" 
 
class CDockPanelBase: public CDockablePane 
public
    CDockPanelBase(void); 
    ~CDockPanelBase(void); 
  
    virtual void AdjustLayout()=0; 
 
    virtual void Update(int param=0)=0; 
 
    virtual void CreateLayout()=0; 
     
 
protected
    virtual BOOL CanFloat() const
    virtual BOOL CanBeClosed() const
    virtual BOOL CanAutoHide() const
    virtual BOOL CanAcceptPane(const CBasePane* pBar ) const
 
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); 
    afx_msg void OnSize(UINT nType, int cx, int cy); 
 
    DECLARE_MESSAGE_MAP() 
 
    CFont* GetStaticFont(); 
}; 

推荐答案

不知道这是否有效,但你是否尝试添加一个按钮的命令UI处理程序?也许MFC正在为你禁用它?虽然你似乎有一个例程按钮调用所以...你也有这个:

m_wndPlaylistBrowseFolder.ModifyStyle(WS_DISABLED,0);

能做到吗?

Tom
Don't know if this would work or not, but did you try adding a command UI handler for the button?  Maybe MFC is disabling it for you???  Although you seem to have a routine that the button calls so ... Also you have this:

m_wndPlaylistBrowseFolder.ModifyStyle(WS_DISABLED,0); 

Could that be doing it?

Tom


这篇关于CDockablePane上的按钮被禁用。为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆