我遇到一个难题!请高手指点一下!谢谢!!!!1)一开始,我编程时的需要:
     建立了一个MDI的应用程序。需要在框架视图的左边放一个对话框(类似ToolBar),可以显示和关闭,位置固定(主要用于控制)。2)我的做法:
     创建一对话框ID,使用向导 Create a new Class “基于CDialog”,再手动将其改为“基于CDialogBar类”(基类改为CdialogBar)。
     int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 中加入:
////////////////////////////////////////////////////////////    
if(!m_DlgCenter.Create(this,IDD_DLG_CENTER,
CBRS_LEFT|CBRS_TOOLTIPS|CBRS_FLYBY|CBRS_HIDE_INPLACE,
ID_VIEW_DLG_CENTER)) {
TRACE0("Failed to create dialog bar m_DlgCenter!\n");
return -1;  //fail to creat
}
////////////////////////////////////////////////////////////          虽然可以,但是,对话框ID基于是DialogBar类,它的 麻烦之处 在后面日益显现出来。
      第一,按钮加在上面总是灰色的。而且,不能再使用别人写好的Button类。
      第二,其它的一些控件,也不能使用特殊类(而这些特殊类在基于CDialog的程序中运行良好)。3)所有:
   不知,如何不改变基类(就是基于CDialog),达到在程序视图框架的左边显示一对话框。可以显示和关闭,位置固定(用于控制)。同时,新建文档的视图显示时,填充剩余的部分。
   
   有那位高手遇到过类似的问题,请指导一下万分感谢!!

解决方案 »

  1.   

    CCJLib库里有个从CControlBar派生的结合CTabCtrl的类。
    就是仿vc ide界面的那种是吧。
    你的e_mail,我星期后放给你。
      

  2.   

    谢谢!! MyEmail:[email protected]
      

  3.   

    我的程序是简单的应用,
    对CJLibrary,我一直不会用。好像比较繁,所有一直没有学。不过用它编出的界面是挺好的。谢谢风中王子的关注! My Email:  [email protected]我就不知道,是不是有简单的方法,使用基类“CDialog”,就可以实现对话框的停泊。。
      

  4.   

    能不能给我也发一份!
    [email protected]
      

  5.   

    你去查msdn,有篇文章手把手教怎么改.
    不能直接改的原因是
    CDIALOGBAR不是从CDIALOG派生的,而是直接从CWND派生的.CDIALOGBAR和CCONTROLBAR等都是直接从CWND派生的.所以即使classwizzard也不能显示控件ID.
      

  6.   

    http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q185672&
    看看这里才彻底解决问题.
    我摘要了九步列出来(例子就看上面的url吧)
    1.Change the base class from CDialog to CDialogBar in the class declaration. Don't forget to also change the base class in BEGIN_MESSAGE_MAP in the .cpp file. 
    2.Change the constructor in both the .h and the .cpp files. Also make the change to the DoDataExchange(). Below are three items to change. 
    3.Remove "virtual BOOL OnInitDialog();" from the class header and add "afx_msg LONG OnInitDialog ( UINT, LONG );" in its place. 
    4.Add "ON_MESSAGE(WM_INITDIALOG, OnInitDialog );" to the message map in the .CPP implementation file
    5.Make the OnInitDialog() conversion as the example(见例子)
    6.Make sure the dialog box resource styles to the following: 
    Style: Child
    Boarder: None
    Visible: Unchecked 
    At this point, everything has been reconnected to make the transformation from a CDialog class to a CDialogBar class work correctly. Now, create and use it. 
    7.Add an instance of the derived CDialogBar to the CframeWnd-derived class (normally called CMainFrame). 
    8.Call the create method for the m_myDlgBar variable in the CFrameWnd::OnCreate() method
    9.
    Finally, you an support dynamic docking and resizing of the CDialogBar其实这里涉及的一个问题就是如何从classwizzard列表里没有的基类派生新类.
    通用的说明见下面的url:
    http://support.microsoft.com/default.aspx?scid=kb;en-us;Q99161
      

  7.   

    那位高手做做看么,看看是不是灰色的。为什么不能用按钮控件。
    My Email: [email protected]
    多谢!!
      

  8.   

    不好意思,现在才找到这个贴子。看看这个是不是你想要的。
    http://www.vckbase.com/code/winview/advui/IECtrlBar.zip
      

  9.   

    我做了一个这个按钮在Main_Frame中的Clicked消息响应。这个按钮就不灰了,但是。假如我给它定义一个CButton对象m_btn1,使用m_btn1.EnableWindow(FALSE);却无法让这个按钮变灰。这是为什么??还有,这个Clicked的消息响应是在Main_Frame中的,所以使用起来很不方便,但是直接建立消息响应在Dialog(basede DialogBar),却无法使这个按钮“使能”,怎么办。高手指点一下!
    谢谢了!!!
      

  10.   

    to:ZHENG017
    [email protected]
    麻烦给我也发一个