📄 sizeview.cpp
字号:
// sizeView.cpp : implementation of the CSizeView class
//
#include "stdafx.h"
#include "size.h"
#include "sizeDoc.h"
#include "sizeView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSizeView
IMPLEMENT_DYNCREATE(CSizeView, CView)
BEGIN_MESSAGE_MAP(CSizeView, CView)
//{{AFX_MSG_MAP(CSizeView)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSizeView construction/destruction
CSizeView::CSizeView()
{
// TODO: add construction code here
}
CSizeView::~CSizeView()
{
}
BOOL CSizeView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CSizeView drawing
void CSizeView::OnDraw(CDC* pDC)
{
CSizeDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// just draw 2 200 unit lines with arrow heads
pDC->MoveTo(5,194);
pDC->LineTo(10,199);
pDC->LineTo(10,0);
pDC->LineTo(5,5);
pDC->MoveTo(10,0);
pDC->LineTo(15,5);
pDC->MoveTo(10,199);
pDC->LineTo(15,194);
pDC->MoveTo(5,95);
pDC->LineTo(0,100);
pDC->LineTo(199,100);
pDC->LineTo(194,95);
pDC->MoveTo(199,100);
pDC->LineTo(194,105);
pDC->MoveTo(0,100);
pDC->LineTo(5,105);
}
/////////////////////////////////////////////////////////////////////////////
// CSizeView diagnostics
#ifdef _DEBUG
void CSizeView::AssertValid() const
{
CView::AssertValid();
}
void CSizeView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CSizeDoc* CSizeView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CSizeDoc)));
return (CSizeDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CSizeView message handlers
void CSizeView::OnInitialUpdate()
{
DWORD style,exstyle;
CRect framerect, viewrect(0,0,200,200);
CFrameWnd *frame=GetParentFrame();
style=GetStyle();
exstyle=GetExStyle(); // view styles!
::AdjustWindowRectEx(&viewrect,style,FALSE,exstyle);
style=frame->GetStyle();
exstyle=frame->GetExStyle(); // frame styles!
// NOTE: SDI frame has menu (TRUE), but an MDI child frame would not (FALSE)
::AdjustWindowRectEx(&viewrect,style,TRUE,exstyle);
frame->GetWindowRect(&framerect); // don't lose top left corner
framerect.right=framerect.left+viewrect.Width();
framerect.bottom=framerect.top+viewrect.Height();
frame->MoveWindow(&framerect);
CView::OnInitialUpdate();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -