分割窗口问题?

vcmfc 2000-10-07 04:00:00
我在程序中进行窗口分割,先分成左右,再将左分成上下,现遇到一个问题:程序运行是左边分割成上下窗口的部分根本就没有显示出来我设置的大小,(也就是说分割条与主框架紧靠着)这是为什么呢?,如果不是把第一个进行分割的话却正常显示。
我的代码:
m_wndSplitter.CreateStatic(this,1,2);
m_wndSplitter2.CreateStatic(&m_wndSplitter,2,1);
m_wndSplitter2.CreateView(0,0,RUNTIME_CLASS(CSendView),CSize(150,150),pContext);
m_wndSplitter2.CreateView(1,0,RUNTIME_CLASS(CAppendView),CSize(150,200),pContext);
m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CWinPoPupView),CSize(150,100),pContext);
SetActiveView((CView*)m_wndSplitter2.GetPane(0,0));
...全文
150 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
RedFire 2000-10-08
  • 打赏
  • 举报
回复
我也不知道具体的原因,但是你可以在创建视之后更改一下大小。在
SetActiveView((CView*)m_wndSplitter2.GetPane(0,0));

前面加上如下两条语句就行了。
// 注意:前面一个是理想大小,后面一个是最小大小
m_wndSplitter.SetColumnInfo(0, 150, 150);
m_wndSplitter.RecalcLayout( );

RedFire 2000-10-08
  • 打赏
  • 举报
回复
有没有人知道?
vcmfc 2000-10-08
  • 打赏
  • 举报
回复
谢谢RedFire,能否交个朋友。
xwind 2000-10-07
  • 打赏
  • 举报
回复
在msdn中对CreateStatic的帮助中有这么一段话:
When you create a static splitter window, you must at the same time create all its panes.
我想主要就是因为这个原因吧,具体你可以看看msdn的例程viewex,下面就是它的代码:

BOOL C3WaySplitterFrame::OnCreateClient(LPCREATESTRUCT lpcs,
CCreateContext* pContext)
{
// create a splitter with 1 row, 2 columns
if (!m_wndSplitter.CreateStatic(this, 1, 2))
{
TRACE0("Failed to CreateStaticSplitter\n");
return FALSE;
}

// add the first splitter pane - the default view in column 0
if (!m_wndSplitter.CreateView(0, 0,
pContext->m_pNewViewClass, CSize(200, 50), pContext))
{
TRACE0("Failed to create first pane\n");
return FALSE;
}

// add the second splitter pane - which is a nested splitter with 2 rows
if (!m_wndSplitter2.CreateStatic(
&m_wndSplitter, // our parent window is the first splitter
2, 1, // the new splitter is 2 rows, 1 column
WS_CHILD | WS_VISIBLE | WS_BORDER, // style, WS_BORDER is needed
m_wndSplitter.IdFromRowCol(0, 1)
// new splitter is in the first row, 2nd column of first splitter
))
{
TRACE0("Failed to create nested splitter\n");
return FALSE;
}

// now create the two views inside the nested splitter
int cyText = max(lpcs->cy - 70, 20); // height of text pane

if (!m_wndSplitter2.CreateView(0, 0,
RUNTIME_CLASS(CTextView), CSize(0, cyText), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
if (!m_wndSplitter2.CreateView(1, 0,
RUNTIME_CLASS(CColorView), CSize(0, 0), pContext))
{
TRACE0("Failed to create third pane\n");
return FALSE;
}

// it all worked, we now have two splitter windows which contain
// three different views
return TRUE;
}

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧