동연총결산04-대화상자01

6896 단어
자원 보기를 열고 Dialog에서 마우스 오른쪽 버튼으로 삽입
 
// Dialog2View.cpp : implementation of the CDialog2View class
//

#include "stdafx.h"
#include "Dialog2.h"

#include "Dialog2Doc.h"
#include "Dialog2View.h"
#include "MyDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDialog2View

IMPLEMENT_DYNCREATE(CDialog2View, CView)

BEGIN_MESSAGE_MAP(CDialog2View, CView)
	//{{AFX_MSG_MAP(CDialog2View)
	ON_COMMAND(ID_MENUITEM32771, OnMenuitem32771)
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CDialog2View construction/destruction

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

}

CDialog2View::~CDialog2View()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CDialog2View drawing

void CDialog2View::OnDraw(CDC* pDC)
{
	CDialog2Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	pDC->TextOut(20, 20, strName);
}

/////////////////////////////////////////////////////////////////////////////
// CDialog2View printing

BOOL CDialog2View::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CDialog2View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CDialog2View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CDialog2View diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CDialog2View message handlers

void CDialog2View::OnMenuitem32771() 
{
	// TODO: Add your command handler code here
	MyDialog my;
	my.DoModal();

	if (my.DoModal() == IDOK)
	{
//		MessageBox(my.m_strName);
		strName = my.m_strName;
		Invalidate();
	}
}

 
control을 사용할 때, 연결 컨트롤 형식은 MyDialog 클래스에서만 사용할 수 있으며, 중간 변수strID를 추가합니다.
// Dialog2View.cpp : implementation of the CDialog2View class
//

#include "stdafx.h"
#include "Dialog2.h"

#include "Dialog2Doc.h"
#include "Dialog2View.h"
#include "MyDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDialog2View

IMPLEMENT_DYNCREATE(CDialog2View, CView)

BEGIN_MESSAGE_MAP(CDialog2View, CView)
	//{{AFX_MSG_MAP(CDialog2View)
	ON_COMMAND(ID_MENUITEM32771, OnMenuitem32771)
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CDialog2View construction/destruction

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

}

CDialog2View::~CDialog2View()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CDialog2View drawing

void CDialog2View::OnDraw(CDC* pDC)
{
	CDialog2Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	pDC->TextOut(20, 20, strName);
}

/////////////////////////////////////////////////////////////////////////////
// CDialog2View printing

BOOL CDialog2View::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CDialog2View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CDialog2View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CDialog2View diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CDialog2View message handlers

void CDialog2View::OnMenuitem32771() 
{
	// TODO: Add your command handler code here
	MyDialog my;
	my.DoModal();

//	if (my.DoModal() == IDOK)
	{
//		MessageBox(my.m_strName);
		strName = my.m_strName + " " + my.strID;
		Invalidate();
	}
}

좋은 웹페이지 즐겨찾기