📄 modalwinview.cpp
字号:
// ModalWinView.cpp : implementation of the CModalWinView class
//
#include "stdafx.h"
#include "ModalWin.h"
#include "ModalWinDoc.h"
#include "ModalWinView.h"
#include "ModalFrameWnd.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CModalWinView
IMPLEMENT_DYNCREATE(CModalWinView, CView)
BEGIN_MESSAGE_MAP(CModalWinView, CView)
//{{AFX_MSG_MAP(CModalWinView)
ON_COMMAND(ID_VIEW_GO_MODAL, OnViewGoModal)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CModalWinView construction/destruction
CModalWinView::CModalWinView()
{
// TODO: add construction code here
}
CModalWinView::~CModalWinView()
{
}
BOOL CModalWinView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CModalWinView drawing
void CModalWinView::OnDraw(CDC* pDC)
{
CModalWinDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CModalWinView printing
BOOL CModalWinView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CModalWinView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CModalWinView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CModalWinView diagnostics
#ifdef _DEBUG
void CModalWinView::AssertValid() const
{
CView::AssertValid();
}
void CModalWinView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CModalWinDoc* CModalWinView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CModalWinDoc)));
return (CModalWinDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CModalWinView message handlers
void CModalWinView::OnViewGoModal()
{
// TODO: Add your command handler code here
// Add a pointer to use for the modal window
ModalFrameWnd * pSampleModalWindow;
// Instantiate the frame window object
pSampleModalWindow = new ModalFrameWnd();
// Create the window
pSampleModalWindow->Create( NULL,
_T("Modal Frame Window"),
WS_OVERLAPPEDWINDOW,
CFrameWnd::rectDefault,
AfxGetApp()->m_pMainWnd );
// Turn the parent window off
::EnableWindow( AfxGetApp()->m_pMainWnd->m_hWnd, FALSE );
// Start the modal loop
pSampleModalWindow->RunModalLoop( MLF_SHOWONIDLE );
// destroy the frame
pSampleModalWindow->DestroyWindow();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -