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

📄 egaview.cpp

📁 这是一个用遗传算法来求解目标函数优化问题的源代码
💻 CPP
字号:
// EGAView.cpp : CEGAView 类的实现
//

#include "stdafx.h"
#include "EGA.h"

#include "EGADoc.h"
#include "CntrItem.h"
#include "EGAView.h"
#include ".\egaview.h"
#include "ShowChart.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CEGAView

IMPLEMENT_DYNCREATE(CEGAView, CRichEditView)

BEGIN_MESSAGE_MAP(CEGAView, CRichEditView)
	ON_WM_DESTROY()
	// 标准打印命令
	ON_COMMAND(ID_FILE_PRINT, CRichEditView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CRichEditView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CRichEditView::OnFilePrintPreview)
	ON_COMMAND(ID_RUN, OnRun)
	ON_COMMAND(ID_SHOWCHAR, OnShowchar)
END_MESSAGE_MAP()

// CEGAView 构造/析构

CEGAView::CEGAView()
{
	// TODO: 在此处添加构造代码

}

CEGAView::~CEGAView()
{
}

BOOL CEGAView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: 在此处通过修改 CREATESTRUCT cs 来修改窗口类或
	// 样式

	return CRichEditView::PreCreateWindow(cs);
}

void CEGAView::OnInitialUpdate()
{
	CRichEditView::OnInitialUpdate();

	// 设置打印边距(720 缇 = 1/2 英寸)
	SetMargins(CRect(720, 720, 720, 720));
}


// CEGAView 打印

BOOL CEGAView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// 默认准备
	return DoPreparePrinting(pInfo);
}


void CEGAView::OnDestroy()
{
	// 停用处于析构中的项;这在
	// 使用拆分器视图时非常重要 
   COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
   if (pActiveItem != NULL && pActiveItem->GetActiveView() == this)
   {
      pActiveItem->Deactivate();
      ASSERT(GetDocument()->GetInPlaceActiveItem(this) == NULL);
   }
   CRichEditView::OnDestroy();
}



// CEGAView 诊断

#ifdef _DEBUG
void CEGAView::AssertValid() const
{
	CRichEditView::AssertValid();
}

void CEGAView::Dump(CDumpContext& dc) const
{
	CRichEditView::Dump(dc);
}

CEGADoc* CEGAView::GetDocument() const // 非调试版本是内联的
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEGADoc)));
	return (CEGADoc*)m_pDocument;
}
#endif //_DEBUG


// CEGAView 消息处理程序

void CEGAView::OnRun()
{
	// TODO: 在此添加命令处理程序代码
	CEGA ega;

	ega.StartRun();

	CRichEditCtrl *pRCtrl = &GetRichEditCtrl();
	pRCtrl->SetWindowText(ega.m_Str);


	CShowChart dlg;
	dlg.DoModal();
}

void CEGAView::OnShowchar()
{
	// TODO: 在此添加命令处理程序代码
	CShowChart dlg;
	dlg.DoModal();
}

⌨️ 快捷键说明

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