📄 mdifullscreenview.cpp
字号:
// MDIFullScreenView.cpp : implementation of the CMDIFullScreenView class
//
#include "stdafx.h"
#include "MDIFullScreen.h"
#include "MDIFullScreenDoc.h"
#include "MDIFullScreenView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMDIFullScreenView
IMPLEMENT_DYNCREATE(CMDIFullScreenView, CView)
BEGIN_MESSAGE_MAP(CMDIFullScreenView, CView)
//{{AFX_MSG_MAP(CMDIFullScreenView)
//ON_COMMAND(ID_VIEW_FULLSCREEN, OnViewFullscreen)
//ON_COMMAND(dfdsfdf, Ondfdsfdf)
//}}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()
/////////////////////////////////////////////////////////////////////////////
// CMDIFullScreenView construction/destruction
CMDIFullScreenView::CMDIFullScreenView()
{
// TODO: add construction code here
}
CMDIFullScreenView::~CMDIFullScreenView()
{
}
BOOL CMDIFullScreenView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMDIFullScreenView drawing
void CMDIFullScreenView::OnDraw(CDC* pDC)
{
CMDIFullScreenDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDC->TextOut(50,50,
"This is a full screen and floating toolbar test!");
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CMDIFullScreenView printing
BOOL CMDIFullScreenView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CMDIFullScreenView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CMDIFullScreenView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CMDIFullScreenView diagnostics
#ifdef _DEBUG
void CMDIFullScreenView::AssertValid() const
{
CView::AssertValid();
}
void CMDIFullScreenView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CMDIFullScreenDoc* CMDIFullScreenView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMDIFullScreenDoc)));
return (CMDIFullScreenDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMDIFullScreenView message handlers
void CMDIFullScreenView::OnViewFullscreen()
{
/*
CRect m_FullScreenRect;
CRect WindowRect;
GetWindowRect(&WindowRect);
CRect ClientRect;
RepositionBars(0,0xffff, AFX_IDW_PANE_FIRST, reposQuery,&ClientRect);
ClientToScreen(&ClientRect);
int nFullWidth=GetSystemMetrics(SM_CXSCREEN);
int nFullHeight=GetSystemMetrics(SM_CYSCREEN);
m_FullScreenRect.left=WindowRect.left-ClientRect.left;
m_FullScreenRect.top=WindowRect.top-ClientRect.top;
m_FullScreenRect.right=WindowRect.right-ClientRect.right+nFullWidth;
m_FullScreenRect.bottom=WindowRect.bottom-ClientRect.bottom+nFullHeight;
WINDOWPLACEMENT wndpl;
wndpl.length=sizeof(WINDOWPLACEMENT);
wndpl.flags=0;
wndpl.showCmd=SW_SHOWNORMAL;
wndpl.rcNormalPosition=m_FullScreenRect;
SetWindowPlacement(&wndpl);
*/
BOOL m_bFullScreen; // 是否全屏显示的标志
LONG m_hMainMenu; // 保存菜单句柄
CWnd *pMainWnd = (CWnd *)AfxGetMainWnd();
if (!m_bFullScreen) {
m_hMainMenu = ::GetWindowLong(pMainWnd->GetSafeHwnd(), GWL_ID);
::SetWindowLong(pMainWnd->GetSafeHwnd(), GWL_ID, 0);
pMainWnd->ModifyStyle(WS_CAPTION, 0, SWP_FRAMECHANGED);
AfxGetMainWnd()->ShowWindow(SW_MAXIMIZE);
m_bFullScreen = TRUE;
}
else {
::SetWindowLong(pMainWnd->GetSafeHwnd(), GWL_ID, m_hMainMenu);
pMainWnd->ModifyStyle(0, WS_CAPTION, SWP_FRAMECHANGED);
m_bFullScreen = FALSE;
}
}
void CMDIFullScreenView::Ondfdsfdf()
{
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -