📄 mainfrm.cpp
字号:
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "Draw.h"
#include "Drawdoc.h"
#include "Drawview.h"
#include "MainFrm.h"
#include "Splash.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
class CDrawDoc;
class CDrawView;
extern BOOL m_bOpenPrj;
extern CDrawView* p_View;
//CMemFile pFile;
IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_COMMAND(ID_WINDOW_NEW, OnWindowNew)
ON_WM_CLOSE()
//}}AFX_MSG_MAP
// Global help commands
ON_COMMAND(ID_HELP_FINDER, CMDIFrameWnd::OnHelpFinder)
ON_COMMAND(ID_HELP, CMDIFrameWnd::OnHelp)
ON_COMMAND(ID_CONTEXT_HELP, CMDIFrameWnd::OnContextHelp)
ON_COMMAND(ID_DEFAULT_HELP, CMDIFrameWnd::OnHelpFinder)
END_MESSAGE_MAP()
static UINT BASED_CODE indicators[] =
{
ID_SEPARATOR,
ID_SEPARATOR,
ID_SEPARATOR,
ID_SEPARATOR,
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
}
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
}
//设置各指示器的风格和宽度
m_wndStatusBar.SetPaneInfo(1,300,SBPS_NORMAL,180);
m_wndStatusBar.SetPaneInfo(2,301,SBPS_NORMAL,80);
m_wndStatusBar.SetPaneInfo(3,302,SBPS_NORMAL,80);
// TODO: Remove this if you don't want tool tips or a resizeable toolbar
// m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | CBRS_TOOLTIPS| CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
// 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);
if(!m_wndDlgBar.Create(this,IDD_DIALOGBAR,CBRS_TOP|CBRS_TOOLTIPS|CBRS_FLYBY,IDD_DIALOGBAR))
{
TRACE0("Failed to Create DialogBar\n");
return -1;
}
//m_wndDlgBar.SetDlgItemText(IDC_EDIT1,"1");
CComboBox *p_Com=(CComboBox *)m_wndDlgBar.GetDlgItem(IDC_COMBO1);
p_Com->ResetContent();
p_Com->AddString("PS_SOLID _________");
p_Com->AddString("PS_DASH __ __ __ ");
p_Com->AddString("PS_DOT _ _ _ _ _");
p_Com->AddString("PS_DASHDOT _ __ _ __ _ __");
p_Com->AddString("PS_DASHDOTDOT _ _ __ _ _ __");
p_Com->AddString("PS_NULL _________");
p_Com->AddString("PS_INSIDEEFRAME _________");
p_Com->SetCurSel(0);
//OnWindowNew();
// CG: The following line was added by the Splash Screen component. //CSplashWnd::ShowSplashScreen(this);
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CMDIFrameWnd::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CMDIFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CMDIFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
void CMainFrame::OnClose()
{
CMDIFrameWnd::OnClose();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -