CFrameWnd *m_pMyFrame;
CFixedSplitter m_cSplitter;
CSplitterWnd m_cSplitterone;
oninte()
{
CRect cRect;
GetWindowRect(&cRect);
ScreenToClient(&cRect);
m_pMyFrame->MoveWindow(&cRect);
m_pMyFrame->ShowWindow(SW_SHOW);
}
nt CCQieFenWndDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
CString strMyClass = AfxRegisterWndClass(CS_VREDRAW | CS_HREDRAW,
::LoadCursor(NULL, IDC_ARROW), (HBRUSH) ::GetStockObject(WHITE_BRUSH),
::LoadIcon(NULL, IDI_APPLICATION));
// Create the frame window with "this" as the parent
m_pMyFrame = new CFrameWnd;
m_pMyFrame->Create(strMyClass,"", WS_CHILD, CRect(0,0,0,0), this);
m_pMyFrame->ShowWindow(SW_SHOW);
// and finally, create the splitter with the frame as the parent
m_cSplitter.CreateStatic(m_pMyFrame,2, 1); //在Frame里切分视图窗口为1×2,就是一行两列
m_cSplitterone.CreateStatic(&m_cSplitter,1,2,WS_CHILD|WS_VISIBLE,m_cSplitter.IdFromRowCol(1,0));
m_cSplitter.CreateView(0,0, RUNTIME_CLASS(CPane1),CSize(100,88), NULL);
m_cSplitterone.CreateView(0,0, RUNTIME_CLASS(CPane2),CSize(800,100), NULL);
m_cSplitterone.CreateView(0,1, RUNTIME_CLASS(CPane1),CSize(100,100), NULL);
//
return 0;
}
#pragma once
#include "afxext.h"
class CFixedSplitter :public CSplitterWnd
{
public:
CFixedSplitter(void);
~CFixedSplitter(void);
DECLARE_MESSAGE_MAP()
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
};
#include "StdAfx.h"
#include ".\fixedsplitter.h"
CFixedSplitter::CFixedSplitter(void)
{
}
CFixedSplitter::~CFixedSplitter(void)
{
}
BEGIN_MESSAGE_MAP(CFixedSplitter, CSplitterWnd)
ON_WM_LBUTTONDOWN()
ON_WM_MOUSEMOVE()
ON_WM_SETCURSOR()
ON_WM_CREATE()
END_MESSAGE_MAP()
void CFixedSplitter::OnLButtonDown(UINT nFlags, CPoint point)
{
//回避标准的CSplitterWnd处理过程CSplitterWnd::OnLButtonDown(UINT nFlags, CPoint point);
CWnd::OnLButtonDown(nFlags, point);
}
void CFixedSplitter::OnMouseMove(UINT nFlags, CPoint point)
{
//回避标准的CSplitterWnd::OnMouseMove(nFlags, point);
CWnd::OnMouseMove(nFlags, point);
}
BOOL CFixedSplitter::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
//回避标准的CSplitterWnd::OnSetCursor(pWnd, nHitTest, message);
return CWnd::OnSetCursor(pWnd, nHitTest, message);
}
int CFixedSplitter::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CSplitterWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: 在此添加您专用的创建代码
return 0;
}