livedlgview.cpp

来自「讲mfc的书」· C++ 代码 · 共 98 行

CPP
98
字号
// livedlgView.cpp : implementation of the CLivedlgView class
//

#include "stdafx.h"
#include "livedlg.h"

#include "livedlgDoc.h"
#include "livedlgView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CLivedlgView

IMPLEMENT_DYNCREATE(CLivedlgView, CView)

BEGIN_MESSAGE_MAP(CLivedlgView, CView)
	//{{AFX_MSG_MAP(CLivedlgView)
	ON_COMMAND(ID_GO, OnGo)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CLivedlgView construction/destruction

CLivedlgView::CLivedlgView()
{
	// TODO: add construction code here

}

CLivedlgView::~CLivedlgView()
{
}

BOOL CLivedlgView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CLivedlgView drawing

void CLivedlgView::OnDraw(CDC* pDC)
{
	CLivedlgDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

	CString s;
	s=livedlg.m_name;
	s+=":";
	s+=livedlg.m_email;
	pDC->SetBkMode(TRANSPARENT);
	pDC->TextOut(0,0,s);
}

/////////////////////////////////////////////////////////////////////////////
// CLivedlgView diagnostics

#ifdef _DEBUG
void CLivedlgView::AssertValid() const
{
	CView::AssertValid();
}

void CLivedlgView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CLivedlgDoc* CLivedlgView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CLivedlgDoc)));
	return (CLivedlgDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CLivedlgView message handlers

void CLivedlgView::OnGo() 
{
  if (::IsWindow(livedlg.m_hWnd))
    livedlg.SetFocus();
  else
	  {
	  livedlg.m_View=this;  // Dialog's parent won't be view!
	  livedlg.Create(IDD_ENTRYDLG,this); // show dialog
	  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?