关于界面拆分问题!!! 我是一个初级的MFC爱好者,对于界面的布局和拆分,MFC有没有什么摸版可以用啊,如果没有,自己怎么规划呢?哪位高人可以给点指点,能有个简单例子更好了! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 拆分一般用的是视图,CSplitterWnd. 对于DOC/VIEW结构,肯定是多视;对于Dialog,随便怎么做了:)去看看高手的blog吧:http://blog.csdn.net/enoloo/ 汗~~又说错了,对于DOC/VIEW结构,肯定是CSplitterWnd 给个例子,结构/* | | CTabCtrlTreeView | pane2pane1 -------------------------------- | | | ListCtrl | ListCtrl | pane3 | pane4 | |*/有个问题,就是我写出来,Pane2是规定高度的,Pane3,pane4的高度是随窗体变化的想反过来Pane3,Pane4规定高度,Pane2高度变化不知道怎么做BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) { int cxPane1,cyPane2,cxPane3; cxPane1 = 150; cyPane2 = 380; cxPane3 = 100; if (!m_wndSplitter1.CreateStatic(this, 1, 2)) { TRACE0("Failed to CreateStaticSplitter\n"); return FALSE; } if (!m_wndSplitter1.CreateView(0, 0, RUNTIME_CLASS(CDirTreeView), CSize(cxPane1,0), pContext)) { TRACE0("Failed to create first pane\n"); return FALSE; } if (!m_wndSplitter2.CreateStatic( &m_wndSplitter1, 2, 1, WS_CHILD | WS_VISIBLE | WS_BORDER, m_wndSplitter1.IdFromRowCol(0, 1) )) { TRACE0("Failed to create nested splitter\n"); return FALSE; } if (!m_wndSplitter2.CreateView(0, 0, pContext->m_pNewViewClass, CSize(0, cyPane2), pContext)) { TRACE0("Failed to create second pane\n"); return FALSE; } if (!m_wndSplitter3.CreateStatic( &m_wndSplitter2, 1, 2, WS_CHILD | WS_VISIBLE | WS_BORDER, m_wndSplitter2.IdFromRowCol(1, 0) )) { TRACE0("Failed to create nested splitter\n"); return FALSE; } if (!m_wndSplitter3.CreateView(0, 0, RUNTIME_CLASS(CDirTreeView)/*RUNTIME_CLASS(CDirTreeView)*/, CSize(cxPane3, 0), pContext)) { TRACE0("Failed to create third pane\n"); return FALSE; } if (!m_wndSplitter3.CreateView(0, 1, RUNTIME_CLASS(CDirTreeView)/*RUNTIME_CLASS(CDirTreeView)*/, CSize(lpcs->cx-cxPane3-cxPane1, 0), pContext)) { TRACE0("Failed to create third pane\n"); return FALSE; } return TRUE;}BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs){ if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; cs.dwExStyle &= ~WS_EX_CLIENTEDGE; cs.lpszClass = AfxRegisterWndClass(0); return TRUE;} 急需高手!!MFC中引用的c语言代码中含有WinMain函数,如何在运行时把WinMain当做普通函数? 编辑框关联数组 CPrintFrame CPrintView中的几处错误 智能指针的指针怎么做? 一个小问题,急死俺了,谁看到进来一下 用Access连的程序,换台机器就不能运行? 如何知道当前的OS是98还是2000还是Xp 问一下哪里有telnet的原代码下载? 托盘中的应用的通知消息,类似QQ的上下线消息。怎么做的?? 怎样在VC中得到应用程序的所在目录 大家一般是用什么方法来判断和维护socket的状态(比如连接了,还是连接已经断了) 关于EVC开发的超级菜鸟问题.---急!!!
/*
|
| CTabCtrl
TreeView | pane2
pane1 --------------------------------
| |
| ListCtrl | ListCtrl
| pane3 | pane4
| |
*/
有个问题,就是
我写出来,Pane2是规定高度的,Pane3,pane4的高度是随窗体变化的
想反过来Pane3,Pane4规定高度,Pane2高度变化不知道怎么做
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
int cxPane1,cyPane2,cxPane3;
cxPane1 = 150;
cyPane2 = 380;
cxPane3 = 100;
if (!m_wndSplitter1.CreateStatic(this, 1, 2))
{
TRACE0("Failed to CreateStaticSplitter\n");
return FALSE;
} if (!m_wndSplitter1.CreateView(0, 0,
RUNTIME_CLASS(CDirTreeView), CSize(cxPane1,0), pContext))
{
TRACE0("Failed to create first pane\n");
return FALSE;
} if (!m_wndSplitter2.CreateStatic(
&m_wndSplitter1,
2, 1,
WS_CHILD | WS_VISIBLE | WS_BORDER,
m_wndSplitter1.IdFromRowCol(0, 1)
))
{
TRACE0("Failed to create nested splitter\n");
return FALSE;
}
if (!m_wndSplitter2.CreateView(0, 0,
pContext->m_pNewViewClass, CSize(0, cyPane2), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
if (!m_wndSplitter3.CreateStatic(
&m_wndSplitter2,
1, 2,
WS_CHILD | WS_VISIBLE | WS_BORDER,
m_wndSplitter2.IdFromRowCol(1, 0)
))
{
TRACE0("Failed to create nested splitter\n");
return FALSE;
}
if (!m_wndSplitter3.CreateView(0, 0,
RUNTIME_CLASS(CDirTreeView)/*RUNTIME_CLASS(CDirTreeView)*/, CSize(cxPane3, 0), pContext))
{
TRACE0("Failed to create third pane\n");
return FALSE;
}
if (!m_wndSplitter3.CreateView(0, 1,
RUNTIME_CLASS(CDirTreeView)/*RUNTIME_CLASS(CDirTreeView)*/, CSize(lpcs->cx-cxPane3-cxPane1, 0), pContext))
{
TRACE0("Failed to create third pane\n");
return FALSE;
}
return TRUE;
}BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
cs.lpszClass = AfxRegisterWndClass(0); return TRUE;
}