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

📄 listmsgview.cpp

📁 实现了无线传感器网络中的一个路由协议算法。
💻 CPP
字号:
// ListMsgView.cpp : implementation file
//

#include "stdafx.h"
#include "SimSensor.h"
#include "ListMsgView.h"
#include "SimSensorDoc.h"

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

/////////////////////////////////////////////////////////////////////////////
// CListMsgView

IMPLEMENT_DYNCREATE(CListMsgView, CView)

CListMsgView::CListMsgView()
{
}

CListMsgView::~CListMsgView()
{
}


BEGIN_MESSAGE_MAP(CListMsgView, CView)
	//{{AFX_MSG_MAP(CListMsgView)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CListMsgView drawing

void CListMsgView::OnDraw(CDC* pDC)
{
	CSimSensorDoc * pDoc = (CSimSensorDoc *)GetDocument();
	CString Str;
	//m_ListCtrl.InsertColumn(0,"Cat ID",LVCFMT_LEFT,-1,0);
	//m_ListCtrl.InsertColumn(1,"Category",LVCFMT_LEFT,-1,1);
	//m_ListCtrl.SetColumnWidth(0, 70);
	//m_ListCtrl.SetColumnWidth(1, 200);
	//::MessageBox(NULL,"hehe","hehe",MB_OK);
	TRACE("ListView OnDraw!\n");
	CMsg *pMsg = pDoc->MsgBuff.GetMsg();
	while ( pMsg!=NULL ) {
		Str.Format("Received Msg:((%d,%d),(%d,%d),%d,data)",pMsg->Destination.x,pMsg->Destination.y,pMsg->Origination.x,pMsg->Origination.y,pMsg->Type); 
        m_ListCtrl.InsertItem (0,Str,0);
		m_ListCtrl.SetItemText(0,1,Str);
		DELETE_OBJECT(pMsg);
		pMsg = pDoc->MsgBuff.GetMsg();
	}
}

/////////////////////////////////////////////////////////////////////////////
// CListMsgView diagnostics

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

void CListMsgView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CListMsgView message handlers

⌨️ 快捷键说明

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