MFC切分窗口

 

 

 

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;
}

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值