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

📄 gaappview.cpp

📁 求解TSP的模拟退火算法和遗传算法程序和源码
💻 CPP
字号:
// GAAppView.cpp : implementation of the CGAAppView class
//

#include "stdafx.h"
#include "GAApp.h"

#include "GAAppDoc.h"
#include "GAAppView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CGAAppView

IMPLEMENT_DYNCREATE(CGAAppView, CListView)

BEGIN_MESSAGE_MAP(CGAAppView, CListView)
	//{{AFX_MSG_MAP(CGAAppView)
		// 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_MESSAGE(WYWM_INFOVIEWAPPENDINFO, OnAppendOutputInfo)
	ON_COMMAND(ID_FILE_PRINT, CListView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CListView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CListView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CGAAppView construction/destruction

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

}

CGAAppView::~CGAAppView()
{
}

BOOL CGAAppView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs
	cs.style |= WS_HSCROLL | WS_VSCROLL;
	cs.style |= LVS_REPORT; // | LVS_NOCOLUMNHEADER;

	return CListView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CGAAppView drawing

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

void CGAAppView::OnInitialUpdate()
{
	CListView::OnInitialUpdate();

	CListCtrl& control = GetListCtrl();
	control.InsertColumn(0, _T(""),LVCFMT_LEFT );
	control.SetColumnWidth( 0, LVSCW_AUTOSIZE_USEHEADER );

	// TODO: You may populate your ListView with items by directly accessing
	//  its list control through a call to GetListCtrl().
}

/////////////////////////////////////////////////////////////////////////////
// CGAAppView printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CGAAppView diagnostics

#ifdef _DEBUG
void CGAAppView::AssertValid() const
{
	CListView::AssertValid();
}

void CGAAppView::Dump(CDumpContext& dc) const
{
	CListView::Dump(dc);
}

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

/////////////////////////////////////////////////////////////////////////////
// CGAAppView message handlers

void CGAAppView::AddString(CString strAppendString)
{
	CListCtrl& control = GetListCtrl();

	int nIndex = control.GetItemCount();

	nIndex = control.GetItemCount();
	
	control.InsertItem( nIndex, strAppendString );
	control.EnsureVisible( nIndex, FALSE );
}

void CGAAppView::OnAppendOutputInfo(WPARAM pString, LPARAM nType)
{
	CString *pAddstring = (CString*)pString;
	AddString( *pAddstring );
}

void CGAAppView::ClearInfos()
{
	CListCtrl& control = GetListCtrl();
	control.DeleteAllItems();
}

⌨️ 快捷键说明

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