如何在 vc 2008 或 vc 2010 Beta 中将 DialogBar 或对话框放入窗格中

发布于 2024-08-21 23:36:58 字数 1263 浏览 7 评论 0原文

你好,现在我正在 2003 vc++ 中工作,我正在将我的项目转换(迁移)到 vc 2008 或新的 vc 2010 Beta,我看到了 2008、2010 的功能包关于 CDockable Pane(自动 Hode,浮动),所以我需要这个功能,我想将对话框或对话框栏放入窗格(CDockable Pane 类)中,所以我在以下代码中完成了此操作

Myframe 代码片段是:

if (!m_MyPane.Create(L"MyPane", this, CRect(0,0,0,0), true, IDD_DIALOG1, WS_CHILD|WS_VISIBLE))
    return -1;
 AddDockSite();
 EnableDocking(CBRS_ALIGN_ANY);
 EnableAutoHidePanes(CBRS_ALIGN_ANY);
 m_MyPane.EnableDocking(CBRS_ALIGN_ANY);
 DockPane(&m_MyPane, AFX_IDW_DOCKBAR_RIGHT);

MyPane class Definition is :

#include "stdafx.h"

#include "Pane.h"
#include "Resource.h"
#include "MainFrm.h"
#include "soft1.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

CPane1::CPane1()
{
}
CPane1::~CPane1()
{

}

BEGIN_MESSAGE_MAP(CPane1, CDockablePane)
 ON_WM_CREATE()
 ON_WM_SIZE()
END_MESSAGE_MAP()

int CPane1::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
 if (CDockablePane::OnCreate(lpCreateStruct) == -1)
  return -1;

 return 0;
}

void CPane1::OnSize(UINT nType, int cx, int cy)
{
 CDockablePane::OnSize(nType, cx, cy);
}

当我构建时,它不会显示任何错误,并且在框架显示的输出中执行时没有错误mypane 但 mypane 没有显示 IDD_DIALOG1

那么我错过了什么吗?请纠正我的代码以及如何将 IDD_DIALOG1 对话框放入 mypane

请帮助我

问候 巴拉吉

Hi now i am working in 2003 vc++ and i am converting(migrating) my project in to vc 2008 or new vc 2010 Beta,i saw the feature pack of 2008,2010 regards CDockable Pane(Auto Hode,floating),so i require this features ,i want to place a dialogbox or dialog bar into pane(CDockable Pane class), so i done this in my following code

Myframe Code snippet is :

if (!m_MyPane.Create(L"MyPane", this, CRect(0,0,0,0), true, IDD_DIALOG1, WS_CHILD|WS_VISIBLE))
    return -1;
 AddDockSite();
 EnableDocking(CBRS_ALIGN_ANY);
 EnableAutoHidePanes(CBRS_ALIGN_ANY);
 m_MyPane.EnableDocking(CBRS_ALIGN_ANY);
 DockPane(&m_MyPane, AFX_IDW_DOCKBAR_RIGHT);

MyPane class Definition is :

#include "stdafx.h"

#include "Pane.h"
#include "Resource.h"
#include "MainFrm.h"
#include "soft1.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

CPane1::CPane1()
{
}
CPane1::~CPane1()
{

}

BEGIN_MESSAGE_MAP(CPane1, CDockablePane)
 ON_WM_CREATE()
 ON_WM_SIZE()
END_MESSAGE_MAP()

int CPane1::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
 if (CDockablePane::OnCreate(lpCreateStruct) == -1)
  return -1;

 return 0;
}

void CPane1::OnSize(UINT nType, int cx, int cy)
{
 CDockablePane::OnSize(nType, cx, cy);
}

when i build it wont shows any error and executed without error in the output the frame show the mypane but mypane didn't show IDD_DIALOG1

So is it anything am i missed please rectify my code and how to place a IDD_DIALOG1 dialogbox in to mypane

PLEASE HELP ME

REGARDS
G.BALAJI

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南风起 2024-08-28 23:36:58

简而言之,将对话框放入 CDockablePane 中非常困难(我知道我已经做到了)。但如果你使用 CPaneDialog 的话就很容易了。如果要转换以前位于 CDialog 或 CDialogBar 中的对话框,则需要在对话框编辑器中打开“可见”标志。否则会发生一些奇怪的事情。 (CDialog 要求该标志关闭,但 CPaneDialog 要求该标志打开。)

The short answer is it is very hard to put a dialog in a CDockablePane (I know as I have done it). But it is very easy to if you use a CPaneDialog instead. If you are converting a dialog that was previously in a CDialog or CDialogBar you need to turn on the "Visible" flag in the dialog editor. otherwise some odd things happen. (CDialog required the flag to be off but CPaneDialog requires it to be on.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文