📄 mainfrm.cpp
字号:
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "PhysicM.h"
#include "MenuTreeView.h"
#include "SaleView.h"
//#include "LogView.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
//{{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
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
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
}
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CMDIFrameWnd::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
{
CMDIFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CMDIFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
CRect rect;
GetClientRect(&rect);
MenuSplt.CreateStatic(this,2,1);
MenuSplt.SetColumnInfo(0,rect.Width()/2,0);
MenuSplt.SetRowInfo(0,rect.Height()-100,0);
/*
MenuSplt.CreateView(0,0,RUNTIME_CLASS(CMenuView),CSize(150,0),pContext);
MenuSplt.CreateView(1,0,RUNTIME_CLASS(CProviderSet),CSize(0,0),pContext);
*/
ViewSplt.CreateStatic(&MenuSplt,1,2,WS_CHILD | WS_VISIBLE,
MenuSplt.IdFromRowCol(0,0));
ViewSplt.CreateView(0,0,RUNTIME_CLASS(CMenuTreeView),CSize(rect.Width()/4,0),pContext);
ViewSplt.CreateView(0,1,RUNTIME_CLASS(CSaleView),CSize(0,0),pContext);
MenuSplt.CreateView(1,0,RUNTIME_CLASS(CLogView),CSize(0,0),pContext);
// MenuSplt.CreateView(1,0,RUNTIME_CLASS(CL),CSize(0,0),pContext);
pLogView = ((CLogView *)MenuSplt.GetPane(1,0));
AddLog("系统启动");
//使SaleView上的m_Grid自适应屏幕分辨率
((CSaleView *)ViewSplt.GetPane(0,1))->m_Grid.SetWindowPos(&wndTop,0,0,rect.Width()+14,(rect.Height()<400) ? rect.Height()-14 : rect.Height()+24,SWP_NOMOVE);
return CMDIFrameWnd::OnCreateClient(lpcs, pContext);
}
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
//CMDIFrameWnd::OnSize(nType, cx, cy);
if (cx==0 && cy==0) return;
MenuSplt.SetRowInfo(0,(cy>500) ? (cy-120) : (cy-80),0);
ViewSplt.SetColumnInfo(0,(cx/4) - 40 ,0);
RecalcLayout();
CMDIFrameWnd::OnSize(nType, cx, cy);
}
void CMainFrame::AddLog(const char *format,...)
{
va_list vl;
va_start(vl,format);
pLogView->vAddMsg(false,format,vl);
va_end(vl);
}
void CMainFrame::AddErr(const char *format,...)
{
va_list vl;
va_start(vl,format);
pLogView->vAddMsg(true,format,vl);
va_end(vl);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -