1.在DIalog中插入一个新的对话框;
2.在菜单中添加新的工能;
3.在视图中添加头文件;
// wenbenkuangView.cpp : implementation of the CWenbenkuangView class
//
#include "stdafx.h"
#include "wenbenkuang.h"
#include "MyDialog.h"
#include "wenbenkuangDoc.h"
#include "wenbenkuangView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/
// CWenbenkuangView
IMPLEMENT_DYNCREATE(CWenbenkuangView, CView)
BEGIN_MESSAGE_MAP(CWenbenkuangView, CView)
//{{AFX_MSG_MAP(CWenbenkuangView)
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()
/
// CWenbenkuangView construction/destruction
CWenbenkuangView::CWenbenkuangView()
{
// TODO: add construction code here
}
CWenbenkuangView::~CWenbenkuangView()
{
}
BOOL CWenbenkuangView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/
// CWenbenkuangView drawing
void CWenbenkuangView::OnDraw(CDC* pDC)
{
CWenbenkuangDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// pDC->TextOut();
// TODO: add draw code for native data here
}
/
// CWenbenkuangView printing
BOOL CWenbenkuangView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CWenbenkuangView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CWenbenkuangView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/
// CWenbenkuangView diagnostics
#ifdef _DEBUG
void CWenbenkuangView::AssertValid() const
{
CView::AssertValid();
}
void CWenbenkuangView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CWenbenkuangDoc* CWenbenkuangView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CWenbenkuangDoc)));
return (CWenbenkuangDoc*)m_pDocument;
}
#endif //_DEBUG
/
// CWenbenkuangView message handlers
void CWenbenkuangView::OnMenuitem32771()
{ MyDialog my;
my.DoModal();
Invalidate();
// TODO: Add your command handler code here
}