modal_dialog_baseview.cpp

来自「掌握Visual C++编程,挺基础的」· C++ 代码 · 共 117 行

CPP
117
字号
// modal_dialog_baseView.cpp : implementation of the CModal_dialog_baseView class
//

#include "stdafx.h"
#include "modal_dialog_base.h"

#include "modal_dialog_baseDoc.h"
#include "modal_dialog_baseView.h"

#include "InputDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CModal_dialog_baseView

IMPLEMENT_DYNCREATE(CModal_dialog_baseView, CView)

BEGIN_MESSAGE_MAP(CModal_dialog_baseView, CView)
	//{{AFX_MSG_MAP(CModal_dialog_baseView)
	ON_WM_LBUTTONDBLCLK()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CModal_dialog_baseView construction/destruction

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

}

CModal_dialog_baseView::~CModal_dialog_baseView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CModal_dialog_baseView drawing

void CModal_dialog_baseView::OnDraw(CDC* pDC)
{
	CModal_dialog_baseDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CModal_dialog_baseView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CModal_dialog_baseView message handlers

void CModal_dialog_baseView::OnLButtonDblClk(UINT nFlags, CPoint point) 
{
	CInputDlg dlg;
	if( dlg.DoModal() == IDOK )
	{
		CString strName,strAge,strSex,strBook,strSwim,strNetwork;
		strName = "Your Name is: " + dlg.m_strName;
		strAge.Format("Your Age is: %d", dlg.m_nAge);
		if( dlg.m_nSex == 0 )
		{
			strSex = "Your Sex is Male";
		}
		else
		{
			strSex = "Your Sex is Female";
		}
		if( dlg.m_bBook == TRUE )
		{
			strBook = "You like book";
		}
		if( dlg.m_bSwim == TRUE )
		{
			strSwim = "You like swimming";
		}
		if( dlg.m_bNetWork == TRUE )
		{
			strNetwork = "You like network";
		}
		AfxMessageBox( strName + "\n" + strAge + "\n" + strSex + "\n" + strBook + "\n" + strSwim + "\n" + strNetwork + "\n" );
	}
	
	CView::OnLButtonDblClk(nFlags, point);
}

⌨️ 快捷键说明

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