怎么动态分割sdi? 在静态分割后动态改变视图(内容中描述)
如何动态分割sdi? 在静态分割后动态改变视图(内容中描述)
动态分割很多参考资料都是 MDI的.有没有动态分割SDI的啊
///////////////////////////////////////////////////////////
在静态分割中,默认设定
m_wndSplitterH.CreateView(0,0,RUNTIME_CLASS(CRealData),CSize(350,400),pContext);
现在在左边的树目录中
比如
点击树目录的 a 是 CRealData
点击树目录的 b 是 CXFY
点击树目录的 c 是 CXYZ
CRealData,CXFY,CXYZ都是 CFromView
------解决方案--------------------
这个是动态切换视图.有很多现成的例子的.
CView* CQuestSaleModeView::SwitchMainView(bool bToMainView, CView* pView)
{
CRect rect;
this-> GetClientRect(rect);
if (this-> m_bIsLeftHand != this-> GetDocument()-> IsLeftHand())
{
ChangeLayout();
this-> m_bIsLeftHand = this-> GetDocument()-> IsLeftHand();
bToMainView = true;
this-> m_bIsMainView = false;
}
CQuestSplitterWnd* pSplitter = &m_wndSplitter4;
if (this-> GetDocument()-> IsLeftHand())
{
pSplitter = &m_wndSplitter3;
}
if (bToMainView)
{
if (!this-> m_bIsMainView)
{
// Switch to MainView
this-> ResetSaleView();
this-> SwitchSaleView(0, this-> GetMainFrame()-> m_pSaleInfoView);
this-> SwitchSaleView(1, this-> GetMainFrame()-> m_pSaleLineView);
this-> SwitchSaleView(2, this-> GetMainFrame()-> m_pSaleCurrentView);
this-> SwitchSaleView(3, this-> GetMainFrame()-> m_pSaleTotalView);
pSplitter-> SetRowInfo(0, this-> m_nInfoHeight, 0);
pSplitter-> SetRowInfo(1, this-> m_nListHeight, 0);
pSplitter-> SetRowInfo(2, this-> m_nCurrentHeight, 0);
pSplitter-> SetRowInfo(3, this-> m_nTotalHeight, 0);
pSplitter-> RecalcLayout();
this-> m_bIsMainView = true;
this-> m_bIsNoticeView = false;
}
else if (this-> m_bIsNoticeView)
{
this-> SwitchSaleView(1, this-> GetMainFrame()-> m_pSaleLineView);
this-> m_bIsNoticeView = false;
}
return NULL;
}
else
{
if (this-> m_bIsMainView)
{
if (pView != NULL)
{
this-> ResetSaleView();
this-> SwitchSaleView(0, this-> GetMainFrame()-> m_pSaleTotalView);
this-> SwitchSaleView(1, this-> GetMainFrame()-> m_pSaleCurrentView);
this-> SwitchSaleView(2, pView);
this-> SwitchSaleView(3, this-> GetMainFrame()-> m_pSaleInfoView);
pSplitter-> SetRowInfo(0, this-> m_nTotalHeight, 0);
pSplitter-> SetRowInfo(1, this-> m_nCurrentHeight, 0);
pSplitter-> SetRowInfo(2, this-> m_nProductHeight, 0);
pSplitter-> SetRowInfo(3, 0, 0);
pSplitter-> RecalcLayout();
this-> m_bIsMainView = false;
}
return NULL;
}
else
{
return this-> SwitchSaleView(2, pView);
}
}
}
------解决方案--------------------
CView* CQuestSaleModeView::SwitchSaleView(int nPos, CView *pView)
{
try
{
if (this-> GetDocument()-> IsLeftHand())
return m_wndSplitter3.SwitchView(nPos, 0, pView);
else
return m_wndSplitter4.SwitchView(nPos, 0, pView);
动态分割很多参考资料都是 MDI的.有没有动态分割SDI的啊
///////////////////////////////////////////////////////////
在静态分割中,默认设定
m_wndSplitterH.CreateView(0,0,RUNTIME_CLASS(CRealData),CSize(350,400),pContext);
现在在左边的树目录中
比如
点击树目录的 a 是 CRealData
点击树目录的 b 是 CXFY
点击树目录的 c 是 CXYZ
CRealData,CXFY,CXYZ都是 CFromView
------解决方案--------------------
这个是动态切换视图.有很多现成的例子的.
CView* CQuestSaleModeView::SwitchMainView(bool bToMainView, CView* pView)
{
CRect rect;
this-> GetClientRect(rect);
if (this-> m_bIsLeftHand != this-> GetDocument()-> IsLeftHand())
{
ChangeLayout();
this-> m_bIsLeftHand = this-> GetDocument()-> IsLeftHand();
bToMainView = true;
this-> m_bIsMainView = false;
}
CQuestSplitterWnd* pSplitter = &m_wndSplitter4;
if (this-> GetDocument()-> IsLeftHand())
{
pSplitter = &m_wndSplitter3;
}
if (bToMainView)
{
if (!this-> m_bIsMainView)
{
// Switch to MainView
this-> ResetSaleView();
this-> SwitchSaleView(0, this-> GetMainFrame()-> m_pSaleInfoView);
this-> SwitchSaleView(1, this-> GetMainFrame()-> m_pSaleLineView);
this-> SwitchSaleView(2, this-> GetMainFrame()-> m_pSaleCurrentView);
this-> SwitchSaleView(3, this-> GetMainFrame()-> m_pSaleTotalView);
pSplitter-> SetRowInfo(0, this-> m_nInfoHeight, 0);
pSplitter-> SetRowInfo(1, this-> m_nListHeight, 0);
pSplitter-> SetRowInfo(2, this-> m_nCurrentHeight, 0);
pSplitter-> SetRowInfo(3, this-> m_nTotalHeight, 0);
pSplitter-> RecalcLayout();
this-> m_bIsMainView = true;
this-> m_bIsNoticeView = false;
}
else if (this-> m_bIsNoticeView)
{
this-> SwitchSaleView(1, this-> GetMainFrame()-> m_pSaleLineView);
this-> m_bIsNoticeView = false;
}
return NULL;
}
else
{
if (this-> m_bIsMainView)
{
if (pView != NULL)
{
this-> ResetSaleView();
this-> SwitchSaleView(0, this-> GetMainFrame()-> m_pSaleTotalView);
this-> SwitchSaleView(1, this-> GetMainFrame()-> m_pSaleCurrentView);
this-> SwitchSaleView(2, pView);
this-> SwitchSaleView(3, this-> GetMainFrame()-> m_pSaleInfoView);
pSplitter-> SetRowInfo(0, this-> m_nTotalHeight, 0);
pSplitter-> SetRowInfo(1, this-> m_nCurrentHeight, 0);
pSplitter-> SetRowInfo(2, this-> m_nProductHeight, 0);
pSplitter-> SetRowInfo(3, 0, 0);
pSplitter-> RecalcLayout();
this-> m_bIsMainView = false;
}
return NULL;
}
else
{
return this-> SwitchSaleView(2, pView);
}
}
}
------解决方案--------------------
CView* CQuestSaleModeView::SwitchSaleView(int nPos, CView *pView)
{
try
{
if (this-> GetDocument()-> IsLeftHand())
return m_wndSplitter3.SwitchView(nPos, 0, pView);
else
return m_wndSplitter4.SwitchView(nPos, 0, pView);