📄 mylistview.cpp
字号:
// MyListView.cpp : implementation file
//
#include "stdafx.h"
#include "RyxGps.h"
#include "MyListView.h"
#include "RyxGpsDoc.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyListView
IMPLEMENT_DYNCREATE(CMyListView, CListView)
CMyListView::CMyListView()
{
}
CMyListView::~CMyListView()
{
}
BEGIN_MESSAGE_MAP(CMyListView, CListView)
//{{AFX_MSG_MAP(CMyListView)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
ON_MESSAGE(WM_MYNOTIFY,OnMyNotify)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyListView drawing
void CMyListView::OnDraw(CDC* pDC)
{
CRyxGpsDoc* pDoc = GetDocument();
// TODO: add draw code here
}
/////////////////////////////////////////////////////////////////////////////
// CMyListView diagnostics
#ifdef _DEBUG
void CMyListView::AssertValid() const
{
CListView::AssertValid();
}
void CMyListView::Dump(CDumpContext& dc) const
{
CListView::Dump(dc);
}
CRyxGpsDoc* CMyListView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CRyxGpsDoc)));
return (CRyxGpsDoc*)m_pDocument;
}
#endif //_DEBUG
void CMyListView::OnMyNotify(WPARAM wParam,LPARAM lParam)
{
CRyxGpsDoc* pDoc = GetDocument();
char pszNum[10];
char pszTemp[50];
int i,j;
int iNum;
int iOffset;
GetListCtrl().DeleteAllItems();
pDoc->GetSubWord(22,pszNum);
iNum=atoi(pszNum);
if(pDoc->m_ReveiverID==1)
iOffset=22;
else if(pDoc->m_ReveiverID==2)
{
switch(iNum)
{
case 10:
iOffset=84;
break;
case 11:
iOffset=90;
break;
default:
break;
}
}
for(i=0;i<iNum;i++)
{
pDoc->GetSubWord(iOffset+i*6+1,pszTemp);
GetListCtrl().InsertItem(i,pszTemp,-1);
for(j=2;j<=6;j++)
{
pDoc->GetSubWord(iOffset+i*6+j,pszTemp);
GetListCtrl().SetItemText(i,j-1,pszTemp);
}
}
}
/////////////////////////////////////////////////////////////////////////////
// CMyListView message handlers
void CMyListView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
GetListCtrl().SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
for(int i=5;i>=0;i--)
GetListCtrl().DeleteColumn(i);
GetListCtrl().InsertColumn(0,_T("卫星号"),LVCFMT_LEFT,50);
GetListCtrl().InsertColumn(1,_T("高度角"),LVCFMT_LEFT,50);
GetListCtrl().InsertColumn(2,_T("方位角"),LVCFMT_LEFT,50);
GetListCtrl().InsertColumn(3,_T("信噪比"),LVCFMT_LEFT,50);
GetListCtrl().InsertColumn(4,_T("载波相位"),LVCFMT_LEFT,120);
GetListCtrl().InsertColumn(5,_T("伪距"),LVCFMT_LEFT,200);
}
BOOL CMyListView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Add your specialized code here and/or call the base class
if(CListView::PreCreateWindow(cs)==FALSE)
return FALSE;
cs.style&=~LVS_TYPEMASK;
cs.style|=LVS_REPORT;
return TRUE;
}
void CMyListView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView)
{
// TODO: Add your specialized code here and/or call the base class
if(bActivate)
{
CMainFrame *pFrame;
pFrame=(CMainFrame *)AfxGetMainWnd();
pFrame->SetActiveView((CView *)(pFrame->m_wndSplitter1.GetPane(1,0)));
return;
}
CListView::OnActivateView(bActivate, pActivateView, pDeactiveView);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -