www.pudn.com > FullScreen.rar > FullScreenView.cpp, change:2010-10-16,size:3250b


// FullScreenView.cpp : implementation of the CFullScreenView class 
// 
 
#include "stdafx.h" 
#include "FullScreen.h" 
 
#include "FullScreenDoc.h" 
#include "FullScreenView.h" 
#include "mainFrm.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CFullScreenView 
 
IMPLEMENT_DYNCREATE(CFullScreenView, CEditView) 
 
BEGIN_MESSAGE_MAP(CFullScreenView, CEditView) 
	//{{AFX_MSG_MAP(CFullScreenView) 
	ON_WM_KEYUP() 
	//}}AFX_MSG_MAP 
	// Standard printing commands 
	ON_COMMAND(ID_FILE_PRINT, CEditView::OnFilePrint) 
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CEditView::OnFilePrint) 
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CEditView::OnFilePrintPreview) 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CFullScreenView construction/destruction 
 
CFullScreenView::CFullScreenView() 
{ 
	// TODO: add construction code here 
 
} 
 
CFullScreenView::~CFullScreenView() 
{ 
} 
 
BOOL CFullScreenView::PreCreateWindow(CREATESTRUCT& cs) 
{ 
	// TODO: Modify the Window class or styles here by modifying 
	//  the CREATESTRUCT cs 
 
	BOOL bPreCreated = CEditView::PreCreateWindow(cs); 
	cs.style &= ~(ES_AUTOHSCROLL|WS_HSCROLL);	// Enable word-wrapping 
 
	return bPreCreated; 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CFullScreenView drawing 
 
void CFullScreenView::OnDraw(CDC* pDC) 
{ 
	CFullScreenDoc* pDoc = GetDocument(); 
	ASSERT_VALID(pDoc); 
	// TODO: add draw code for native data here 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CFullScreenView printing 
 
BOOL CFullScreenView::OnPreparePrinting(CPrintInfo* pInfo) 
{ 
	// default CEditView preparation 
	return CEditView::OnPreparePrinting(pInfo); 
} 
 
void CFullScreenView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo) 
{ 
	// Default CEditView begin printing. 
	CEditView::OnBeginPrinting(pDC, pInfo); 
} 
 
void CFullScreenView::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo) 
{ 
	// Default CEditView end printing 
	CEditView::OnEndPrinting(pDC, pInfo); 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CFullScreenView diagnostics 
 
#ifdef _DEBUG 
void CFullScreenView::AssertValid() const 
{ 
	CEditView::AssertValid(); 
} 
 
void CFullScreenView::Dump(CDumpContext& dc) const 
{ 
	CEditView::Dump(dc); 
} 
 
CFullScreenDoc* CFullScreenView::GetDocument() // non-debug version is inline 
{ 
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CFullScreenDoc))); 
	return (CFullScreenDoc*)m_pDocument; 
} 
#endif //_DEBUG 
 
///////////////////////////////////////////////////////////////////////////// 
// CFullScreenView message handlers 
 
void CFullScreenView::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)  
{ 
	if(nChar == VK_F11)  
	{ 
		 // 获取主框架窗口的指针  
		CMainFrame* pFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd; 
 
		if(!pFrame->m_isFull) // 如果现在是全屏状态 
		{ 
			//进入全屏显示状态  
			pFrame->FullScreen(); 
		} 
		else // 不是全屏状态 
		{ 
			//退出全屏显示状态  
			pFrame->noFullScreen(); 
		} 
	} 	 
	CEditView::OnKeyUp(nChar, nRepCnt, nFlags); 
}