int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
} if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
} // TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
CSize BarSize; //工具条大小
BarSize.cx = 200;
BarSize.cy = 150;
RECT rt;
if (!(m_DockBar1.Create(_T("m_DockBar1"), this, BarSize, TRUE, WS_CHILD)))
{
TRACE0("Failed to create m_TreeViewBar\n");
return -1;
}
if (!(m_DockBar2.Create(_T("m_DockBar2"), this, BarSize, TRUE, WS_CHILD)))
{
TRACE0("Failed to create m_PictureBar\n");
return -1;
}
m_DockBar1.SetBarStyle(m_DockBar1.GetBarStyle() | CBRS_TOOLTIPS| CBRS_SIZE_FIXED); // TODO: Delete these three lines if you don't want the toolbar to
m_DockBar2.SetBarStyle(m_DockBar2.GetBarStyle() | CBRS_TOOLTIPS| CBRS_SIZE_FIXED); // TODO: Delete these three lines if you don't want the toolbar to m_DockBar1.EnableDocking(CBRS_ALIGN_ANY);
m_DockBar2.EnableDocking(CBRS_ALIGN_ANY);
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
//DockControlBar(&m_wndToolBar);
rt.top = 0;
rt.bottom = 150;
rt.left = 20;
rt.right = 200;
DockControlBar(&m_DockBar1, AFX_IDW_DOCKBAR_LEFT, &rt);
rt.top = 150;
rt.bottom = 300;
DockControlBar(&m_DockBar2, AFX_IDW_DOCKBAR_LEFT, &rt); return 0;
}
请大家帮忙看看,我想要的结果就是左边有两个竖排的浮动窗口,但是有时候却变成并列的两个?BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// CG: The following block was added by the Splitter Bar component.
{
// if (!m_wndSplitter.Create(this,
// 2, 1, // TODO: adjust the number of rows, columns
// CSize(10, 10), // TODO: adjust the minimum pane size
// pContext))
if(!m_wndSplitter.CreateStatic(this, 2, 1))
{
TRACE0("Failed to create splitter bar ");
return FALSE; // failed to create
}
CRect rt;
GetClientRect(&rt);
m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CDockTestView), CSize(rt.Width(), rt.Height() / 2), pContext);
m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CMyView), CSize(rt.Width(), rt.Height() / 2), pContext); return TRUE;
}
}
右边的窗体想居中平均分割两个,但是却总是无法居中分割?
请大家帮忙,在线等待!解决马上给分,不够可以再给!谢谢!
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
} if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
} // TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
CSize BarSize; //工具条大小
BarSize.cx = 200;
BarSize.cy = 150;
RECT rt;
if (!(m_DockBar1.Create(_T("m_DockBar1"), this, BarSize, TRUE, WS_CHILD)))
{
TRACE0("Failed to create m_TreeViewBar\n");
return -1;
}
if (!(m_DockBar2.Create(_T("m_DockBar2"), this, BarSize, TRUE, WS_CHILD)))
{
TRACE0("Failed to create m_PictureBar\n");
return -1;
}
m_DockBar1.SetBarStyle(m_DockBar1.GetBarStyle() | CBRS_TOOLTIPS| CBRS_SIZE_FIXED); // TODO: Delete these three lines if you don't want the toolbar to
m_DockBar2.SetBarStyle(m_DockBar2.GetBarStyle() | CBRS_TOOLTIPS| CBRS_SIZE_FIXED); // TODO: Delete these three lines if you don't want the toolbar to m_DockBar1.EnableDocking(CBRS_ALIGN_ANY);
m_DockBar2.EnableDocking(CBRS_ALIGN_ANY);
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
//DockControlBar(&m_wndToolBar);
rt.top = 0;
rt.bottom = 150;
rt.left = 20;
rt.right = 200;
DockControlBar(&m_DockBar1, AFX_IDW_DOCKBAR_LEFT, &rt);
rt.top = 150;
rt.bottom = 300;
DockControlBar(&m_DockBar2, AFX_IDW_DOCKBAR_LEFT, &rt); return 0;
}
请大家帮忙看看,我想要的结果就是左边有两个竖排的浮动窗口,但是有时候却变成并列的两个?BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// CG: The following block was added by the Splitter Bar component.
{
// if (!m_wndSplitter.Create(this,
// 2, 1, // TODO: adjust the number of rows, columns
// CSize(10, 10), // TODO: adjust the minimum pane size
// pContext))
if(!m_wndSplitter.CreateStatic(this, 2, 1))
{
TRACE0("Failed to create splitter bar ");
return FALSE; // failed to create
}
CRect rt;
GetClientRect(&rt);
m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CDockTestView), CSize(rt.Width(), rt.Height() / 2), pContext);
m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CMyView), CSize(rt.Width(), rt.Height() / 2), pContext); return TRUE;
}
}
右边的窗体想居中平均分割两个,但是却总是无法居中分割?
请大家帮忙,在线等待!解决马上给分,不够可以再给!谢谢!
解决方案 »
- OpenCV为什么只保存视频的前景帧后得到的是无效的文件?附代码
- OpenCV中IplImage图像格式与BYTE图像数据的转换问题?
- 如何获取一个还没显示出来的对话框的句柄?
- 怎么在模式对话框显示前修改其中的静态文本的图片?
- edit和spin的问题。1、如何把某个数放到edit中?2、如何把edit1目前的值取出来?用什么消息或函数?
- 為何沒有嚮應ontimer事件?
- 关于COM中的返回参数,急呀!
- 在MFC中,有一个缓冲区(大小上万)如何快速显示到EDIT控件中
- 有关画线时橡皮筋技术的疑惑,高分求教
- 我想知道 大论坛有多少程序媛MM 数得完么 “阴险\n” 是MM 回+1
- 怎样配置VS7才能使F12能找到定义?
- 中文字符串查找的问题!
void CMainFrame::DockControlBarLeftOf(CControlBar *Bar, CControlBar *LeftOf)
{
CRect rect;
DWORD dw;
UINT n;
//计算WindowRect的精确大小
RecalcLayout();
LeftOf ->GetWindowRect(&rect);
rect.OffsetRect(1,0);
dw = LeftOf ->GetBarStyle();
n = 0;
n = (dw & CBRS_ALIGN_TOP) ? AFX_IDW_DOCKBAR_TOP : n;
n = (dw & CBRS_ALIGN_BOTTOM && n == 0) ? AFX_IDW_DOCKBAR_BOTTOM : n;
n = (dw & CBRS_ALIGN_LEFT && n == 0) ? AFX_IDW_DOCKBAR_LEFT : n;
n = (dw & CBRS_ALIGN_RIGHT && n == 0) ? AFX_IDW_DOCKBAR_RIGHT : n; DockControlBar(Bar, n, &rect);
}2 要居中分割,可以先任意的分割,然后用SetRowInfo/SetColumnInfo来控制每个视图的大小
CRect rt;
GetWindowRect(&rt);
m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CDockTestView), CSize(10, 10), pContext);
m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CMyView), CSize(10, 10), pContext);
m_wndSplitter.SetRowInfo(0, rt.Height() / 2, 10);
m_wndSplitter.SetRowInfo(1, rt.Height() / 2, 10);
m_wndSplitter.RecalcLayout();
但是还是无法解决,每次分割出来的窗口大小都不相同,请帮忙看看,谢谢!