📄 graphicsview.cpp
字号:
// GraphicsView.cpp : implementation of the CGraphicsView class
//
#include "stdafx.h"
#include "Graphics.h"
#include "GraphicsDoc.h"
#include "GraphicsView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CGraphicsView
IMPLEMENT_DYNCREATE(CGraphicsView, CView)
BEGIN_MESSAGE_MAP(CGraphicsView, CView)
//{{AFX_MSG_MAP(CGraphicsView)
// 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
// 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()
/////////////////////////////////////////////////////////////////////////////
// CGraphicsView construction/destruction
CGraphicsView::CGraphicsView()
{
// TODO: add construction code here
}
CGraphicsView::~CGraphicsView()
{
}
BOOL CGraphicsView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CGraphicsView drawing
void CGraphicsView::OnDraw(CDC* pDC)
{
CGraphicsDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CGraphicsView printing
BOOL CGraphicsView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CGraphicsView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CGraphicsView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CGraphicsView diagnostics
#ifdef _DEBUG
void CGraphicsView::AssertValid() const
{
CView::AssertValid();
}
void CGraphicsView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CGraphicsDoc* CGraphicsView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CGraphicsDoc)));
return (CGraphicsDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CGraphicsView message handlers
void CGraphicsView::OnInitialUpdate()
{
CView::OnInitialUpdate();
if (m_ListBox.m_hWnd != NULL)
m_ListBox.DestroyWindow();
if (m_Edit.m_hWnd != NULL)
m_Edit.DestroyWindow();
RECT rc;
rc.top = 0;
rc.bottom = 150;
rc.left = 0;
rc.right = 150;
m_ListBox.Create (WS_BORDER | WS_VSCROLL | LBS_NOTIFY |
WS_VISIBLE, rc, this, IDC_LISTBOX);
m_ListBox.AddString ("Stuff");
m_ListBox.AddString ("More Stuff");
m_ListBox.AddString ("Even more stuff");
RECT rcList;
m_ListBox.GetWindowRect (&rcList);
rc.left = 150;
rc.right = 300;
rc.bottom = rcList.bottom - rcList.top;
m_Edit.Create (WS_BORDER | WS_VSCROLL | ES_CENTER
| ES_MULTILINE | WS_VISIBLE, rc, this,
IDC_EDITBOX);
m_Edit.ShowWindow (SW_SHOWNORMAL);
m_Edit.SetWindowText ("This here's a string that will "
"be placed in the edit box in "
"the edit control on the view "
"window");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -