?? msglistview.cpp
字號(hào):
// MsgListView.cpp : implementation file
//
#include "stdafx.h"
#include "SimSensor.h"
#include "MsgListView.h"
#include "MainFrm.h"
#include "SimSensorDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMsgListView
IMPLEMENT_DYNCREATE(CMsgListView, CListView)
CMsgListView::CMsgListView()
{
InitializeCriticalSection(&Locked);
}
CMsgListView::~CMsgListView()
{
DeleteCriticalSection(&Locked);
}
BEGIN_MESSAGE_MAP(CMsgListView, CListView)
//{{AFX_MSG_MAP(CMsgListView)
ON_WM_CREATE()
ON_COMMAND(ID_CLEAR_RECORDS, OnClearRecords)
ON_WM_RBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMsgListView drawing
void CMsgListView::OnDraw(CDC* pDC)
{
}
/////////////////////////////////////////////////////////////////////////////
// CMsgListView diagnostics
#ifdef _DEBUG
void CMsgListView::AssertValid() const
{
CListView::AssertValid();
}
void CMsgListView::Dump(CDumpContext& dc) const
{
CListView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMsgListView message handlers
//DEL void CMsgListView::OnPaint()
//DEL {
//DEL CPaintDC dc(this); // device context for painting
//DEL
//DEL // TODO: Add your message handler code here
//DEL OnPrepareDC(&dc);
//DEL OnDraw(&dc);
//DEL // Do not call CListView::OnPaint() for painting messages
//DEL }
int CMsgListView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CListView::OnCreate(lpCreateStruct) == -1)
return -1;
CSimSensorDoc *pDoc = (CSimSensorDoc *)GetDocument();
CMsgListView * pListView;
POSITION pos = pDoc->GetFirstViewPosition();
while (pos != NULL) pListView = (CMsgListView *)pDoc->GetNextView(pos);
pDoc->pMsgListView = pListView;
// TODO: Add your specialized creation code here
CListCtrl &ListCtrl = GetListCtrl();
//ListCtrl.InsertColumn(0,"ID",LVCFMT_LEFT,-1,0);
//ListCtrl.SetColumnWidth(0, 50);
ListCtrl.InsertColumn(0,"節(jié)點(diǎn)通訊信息明細(xì)",LVCFMT_LEFT,-1,1);
ListCtrl.SetColumnWidth(0, 300);
return 0;
}
BOOL CMsgListView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Add your specialized code here and/or call the base class
cs.style |= LVS_REPORT;
return CListView::PreCreateWindow(cs);
}
void CMsgListView::OnClearRecords()
{
// TODO: Add your command handler code here
GetListCtrl().DeleteAllItems();
ASSERT(GetListCtrl().GetItemCount() == 0);
}
void CMsgListView::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CMenu menu;
menu.LoadMenu(IDR_RIGHT_POPUP);
CMenu *pPopup=menu.GetSubMenu(0);
ClientToScreen(&point);
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y,
GetParent());
//CListView::OnRButtonDown(nFlags, point);
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -