📄 tspsaview.cpp
字号:
// TspSAView.cpp : implementation of the CTspSAView class
//
#include "stdafx.h"
#include "TspSA.h"
#include "TspSADoc.h"
#include "TspSAView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTspSAView
IMPLEMENT_DYNCREATE(CTspSAView, CListView)
BEGIN_MESSAGE_MAP(CTspSAView, CListView)
//{{AFX_MSG_MAP(CTspSAView)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CTspSAView construction/destruction
CTspSAView::CTspSAView()
{
// TODO: add construction code here
}
CTspSAView::~CTspSAView()
{
}
BOOL CTspSAView::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);
}
/////////////////////////////////////////////////////////////////////////////
// CTspSAView drawing
void CTspSAView::OnDraw(CDC* pDC)
{
CTspSADoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
void CTspSAView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
CListCtrl& control = GetListCtrl();
control.InsertColumn(0, _T(""),LVCFMT_LEFT );
control.SetColumnWidth( 0, LVSCW_AUTOSIZE_USEHEADER );
// control.SetExtendedStyle( LVS_EX_FULLROWSELECT );
// TODO: You may populate your ListView with items by directly accessing
// its list control through a call to GetListCtrl().
}
/////////////////////////////////////////////////////////////////////////////
// CTspSAView printing
BOOL CTspSAView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CTspSAView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CTspSAView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CTspSAView diagnostics
#ifdef _DEBUG
void CTspSAView::AssertValid() const
{
CListView::AssertValid();
}
void CTspSAView::Dump(CDumpContext& dc) const
{
CListView::Dump(dc);
}
CTspSADoc* CTspSAView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTspSADoc)));
return (CTspSADoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CTspSAView message handlers
void CTspSAView::AddString(CString strAppendString)
{
CListCtrl& control = GetListCtrl();
int nIndex = control.GetItemCount();
nIndex = control.GetItemCount();
control.InsertItem( nIndex, strAppendString );
control.EnsureVisible( nIndex, FALSE );
}
void CTspSAView::OnAppendOutputInfo(WPARAM pString, LPARAM nType)
{
CString *pAddstring = (CString*)pString;
AddString( *pAddstring );
}
void CTspSAView::ClearInfos()
{
CListCtrl& control = GetListCtrl();
control.DeleteAllItems();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -