📄 ex6_2view.cpp
字号:
// Ex6_2View.cpp : implementation of the CEx6_2View class
//
#include "stdafx.h"
#include "Ex6_2.h"
#include "Ex6_2Doc.h"
#include "Ex6_2View.h"
#include "Ex6_2Dlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEx6_2View
IMPLEMENT_DYNCREATE(CEx6_2View, CView)
BEGIN_MESSAGE_MAP(CEx6_2View, CView)
//{{AFX_MSG_MAP(CEx6_2View)
ON_WM_LBUTTONDOWN()
ON_WM_RBUTTONDOWN()
//}}AFX_MSG_MAP
ON_MESSAGE(WM_SENDMSG,OnSendMsg)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEx6_2View construction/destruction
CEx6_2View::CEx6_2View()
{
// TODO: add construction code here
m_pDlg=new CEx6_2Dlg(this);
}
CEx6_2View::~CEx6_2View()
{
delete m_pDlg;
}
BOOL CEx6_2View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CEx6_2View drawing
void CEx6_2View::OnDraw(CDC* pDC)
{
CEx6_2Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
pDC->TextOut(0,0,"Press the left mouse button here");
pDC->TextOut (100,100,m_pDlg->m_strEdit);
}
/////////////////////////////////////////////////////////////////////////////
// CEx6_2View diagnostics
#ifdef _DEBUG
void CEx6_2View::AssertValid() const
{
CView::AssertValid();
}
void CEx6_2View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CEx6_2Doc* CEx6_2View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEx6_2Doc)));
return (CEx6_2Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CEx6_2View message handlers
void CEx6_2View::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if(m_pDlg->GetSafeHwnd()==0)
m_pDlg->Create(IDD_DIALOG1,this);
m_pDlg->ShowWindow(SW_SHOW);
CView::OnLButtonDown(nFlags, point);
}
void CEx6_2View::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_pDlg->ShowWindow(SW_HIDE);
CView::OnRButtonDown(nFlags, point);
}
LRESULT CEx6_2View::OnSendMsg(WPARAM wParam,LPARAM lParam)
{
if(wParam==IDOK)
{
this->Invalidate();
}
m_pDlg->DestroyWindow();
return 0L;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -