📄 mainfrm.cpp
字号:
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "MCProc.h"
#include "MainFrm.h"
#include "MCProcView.h"
#include "MCLView.h"
#include "MCRView.h"
#include "MCProcDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
m_IsShow=0;
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
void CMainFrame::ActivateFrame(int nCmdShow)
{
// TODO: Add your specialized code here and/or call the base class
m_IsShow=1;
nCmdShow=SW_SHOWMAXIMIZED;
CFrameWnd::ActivateFrame(nCmdShow);
}
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
CRect rt;
BOOL IsCreate=FALSE;
/*创建分割视图*/
if (!m_wndSplitterH.CreateStatic(this,2,1))
{
TRACE0("Failed to create split bar ");
return FALSE; // failed to create
}
if (!m_wndSplitterV.CreateStatic(&m_wndSplitterH,1,2,
WS_CHILD | WS_VISIBLE,m_wndSplitterH.IdFromRowCol(1,0)))
{
TRACE0("Failed to create split bar ");
return FALSE; // failed to create
}
GetClientRect(&rt);
CSize PaneSizeTop(rt.Width(),rt.Height()/2);
CSize PaneSizeLeft(rt.Width()/2,rt.Height()/2);
CSize PaneSizeRight(rt.Width()/2,rt.Height()/2);
IsCreate=m_wndSplitterH.CreateView(0,0,RUNTIME_CLASS(CMCProcView),
PaneSizeTop,pContext);
if(!IsCreate)
return FALSE;
IsCreate=m_wndSplitterV.CreateView(0,0,RUNTIME_CLASS(CMCLView),
PaneSizeLeft,pContext);
if(!IsCreate)
return FALSE;
IsCreate=m_wndSplitterV.CreateView(0,1,RUNTIME_CLASS(CMCRView),
PaneSizeRight,pContext);
if(!IsCreate)
return FALSE;
m_wndSplitterH.RecalcLayout();
m_wndSplitterV.RecalcLayout();
return TRUE;
// return CFrameWnd::OnCreateClient(lpcs, pContext);
}
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
CFrameWnd::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
if(m_IsShow)
{
CRect cr;
GetClientRect(&cr);
m_wndSplitterH.SetRowInfo(0,cr.Height()/2,0);
m_wndSplitterV.SetColumnInfo(0,cr.Width()/2,0);
m_wndSplitterH.RecalcLayout();
m_wndSplitterV.RecalcLayout();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -