⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mfcview.cpp

📁 MFC 和MATLAB 混合编程代码
💻 CPP
字号:
// mfcView.cpp : implementation of the CMfcView class
//

#include "stdafx.h"
#include "mfc.h"
#include <matlib.h>

#include "mfcDoc.h"
#include "mfcView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMfcView

IMPLEMENT_DYNCREATE(CMfcView, CView)

BEGIN_MESSAGE_MAP(CMfcView, CView)
	//{{AFX_MSG_MAP(CMfcView)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CMfcView construction/destruction

CMfcView::CMfcView()
{
	// TODO: add construction code here
    init=false;

}

CMfcView::~CMfcView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CMfcView drawing

void CMfcView::OnDraw(CDC* pDC)
{
	CMfcDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

	// TODO: add draw code for native data here
         if (!init) {
	    initM(MATCOM_VERSION);

            Mm h = winaxes(m_hWnd);
            axesposition(10,10,300,180);
            plot((CL(magic(20+40*rand()))));
            title((CL(TM("Random plot"))));
            xlabel((CL(TM("This is the x axis"))));
            ylabel((CL(TM("This is the y axis"))));
            set(h,(CL(TM("Color")),TM("white")));
            set(h,(CL(TM("Box")),TM("on")));
            init=true;
         }
         drawnow();
}

/////////////////////////////////////////////////////////////////////////////
// CMfcView printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CMfcView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CMfcView message handlers

⌨️ 快捷键说明

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