splitter st 切分窗口

you may add command function in your left view class
just like this
BOOL CLeftView::OnCommand(WPARAM wParam, LPARAM lParam)
{
TRACE("%d, %d/r/n", (int)wParam, (int)lParam);

CMainFrame* pMainFrame = (CMainFrame*)(AfxGetApp()->m_pMainWnd);
VERIFY(NULL != pMainFrame);


if (NULL != pMainFrame->m_pSplitterWnd)
{
pMainFrame->m_pSplitterWnd->SendSplitterMessage(1, 2, wParam, lParam);
}
else
{
CRfxBaseView::OnCommand(wParam, lParam);
}
return TRUE
}

SendSplitterMessage just like this
void ST_SplitterWnd::SendSplitterMessage(int nSide,int nViewIX /* = -1 */, WPARAM wParam, LPARAM lParam)
{
// if the View is -1 then just use the next view...
if (nViewIX == -1) {
nViewIX = m_nCurrentView[nSide] + 1;
if (nViewIX >= (int)m_views[nSide].size()) nViewIX = 0; // rollover to first view
}

CWnd* pWnd = m_views[nSide][nViewIX];

pWnd->PostMessage(WM_COMMAND, wParam, lParam);
}

mainframe
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
m_pSplitterWnd = new ST_SplitterWnd();
m_pSplitterWnd->Create(this,NULL,NULL,pContext,true);

m_nViewNo[0] = m_pSplitterWnd->AddView(LEFT_SIDE,RUNTIME_CLASS(CViewLeft1),pContext);
m_nViewNo[1] = m_pSplitterWnd->AddView(RIGHT_SIDE,RUNTIME_CLASS(CViewRight1),pContext);
m_nViewNo[2] = m_pSplitterWnd->AddView(RIGHT_SIDE,RUNTIME_CLASS(CViewRight2),pContext);
m_nViewNo[3] = m_pSplitterWnd->AddView(RIGHT_SIDE,RUNTIME_CLASS(CViewRight3),pContext);

return TRUE;
}

CViewRight3 message Handling
BEGIN_MESSAGE_MAP(CViewRight3, CView)
ON_COMMAND(ID_VIEW_CHANGE, OnViewChange)
ON_BN_CLICKED(IDC_BTN_1, OnBtnClick1)
ON_BN_CLICKED(IDC_BTN_2, OnBtnClick2)
ON_BN_CLICKED(IDC_BTN_3, OnBtnClick3)
END_MESSAGE_MAP()

and functions

enjoy it  
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值