📄 mainfrm.cpp
字号:
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "PixelFusion.h"
#include "SegmentView.h"
#include "PixelFusionView.h"
#include "FusionView.h"
#include "MainFrm.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)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code !
ON_WM_CREATE()
ON_COMMAND(IDM_DEVIOR, OnDevior)
ON_COMMAND(IDM_KROMO, OnKromo)
ON_COMMAND(IDM_XPBLUE, OnXpblue)
ON_UPDATE_COMMAND_UI(IDM_KROMO, OnUpdateKromo)
ON_UPDATE_COMMAND_UI(IDM_XPBLUE, OnUpdateXpblue)
//}}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()
{
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
void CMainFrame::OnDevior()
{
// TODO: Add your command handler code here
LoadSkinFromResource( AfxGetInstanceHandle(),"DEVIOR" ,"SKINMAGIC");
}
void CMainFrame::OnKromo()
{
// TODO: Add your command handler code here
LoadSkinFromResource( AfxGetInstanceHandle(),"KROMO","SKINMAGIC");
if( !m_bSkinned )
{
VERIFY( 1 == SetWindowSkin( m_hWnd , "MainFrame" ));
VERIFY( 1 == SetDialogSkin( "Dialog" ) );
m_nIndex = 0 ;
}
}
void CMainFrame::OnXpblue()
{
// TODO: Add your command handler code here
LoadSkinFromResource( AfxGetInstanceHandle() , "XPBLUE" ,"SKINMAGIC") ;
}
void CMainFrame::OnUpdateKromo(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(m_nIndex == 0 );
}
void CMainFrame::OnUpdateXpblue(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(m_nIndex == 1 );
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::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( !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
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if (!m_wndSplitter.CreateStatic(this, 1, 3))
{
TRACE0("Failed to CreateStaticSplitter\n");
return FALSE;
}
m_wndSplitter.SetRowInfo(0, 520, 0);
//m_wndSplitter2.SetColumnInfo(0,pDoc->GetDocSize().cx+20,10);
// create the two views inside the nested splitter
int cyText = max(lpcs->cy - 70, 20); // height of text pane
RECT r;
GetClientRect(&r);
int nCx=(r.right-r.left)/2;
int nCy=(r.bottom-r.top);
if (!m_wndSplitter.CreateView(0, 0,
RUNTIME_CLASS(CPixelFusionView), CSize(300, nCy), pContext))//RUNTIME_CLASS(CErPaoProjectView)
{
TRACE0("Failed to create first pane\n");
return FALSE;
}// the default view
if (!m_wndSplitter.CreateView(0, 1,
RUNTIME_CLASS(CSegmentView), CSize(nCx, nCy), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
// add the third splitter pane - the text view in row 1
if (!m_wndSplitter.CreateView(0, 2,
RUNTIME_CLASS(CFusionView), CSize(0, cyText), pContext))
{
TRACE0("Failed to create third pane\n");
return FALSE;
}
SetActiveView((CView*)m_wndSplitter.GetPane(0,0));
return TRUE;
}
void CMainFrame::ActivateFrame(int nCmdShow)
{
// TODO: Add your specialized code here and/or call the base class
nCmdShow = SW_SHOWMAXIMIZED;
CFrameWnd::ActivateFrame(nCmdShow);//使子框架最大
//CFrameWnd::ActivateFrame(nCmdShow);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -