📄 resultview.cpp
字号:
// MyBarLeftBottom.cpp : implementation file
//
#include "stdafx.h"
#include "ResultView.h"
#include "Resource.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CResultView
CResultView::CResultView()
{
// TODO: add construction code here.
}
CResultView::~CResultView()
{
// TODO: add destruction code here.
}
BEGIN_MESSAGE_MAP(CResultView, CCJControlBar)
//{{AFX_MSG_MAP(CResultView)
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CResultView message handlers
static int _gColText[] = { IDS_RESULT_NAME, IDS_RESULT_TIME };
static int _gColSize[] = { 700, 100 };
int CResultView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CCJControlBar::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
if (!m_ListCtrl.Create (WS_TABSTOP|WS_CHILD|WS_VISIBLE|LVS_REPORT,
CRect(0,0,0,0), this, IDC_LIST_CTRL_1))
{
TRACE0("Failed to create view for CMyBarLeft\n");
return -1;
}
SetChild(&m_ListCtrl);
m_ListCtrl.ModifyStyleEx(0, WS_EX_STATICEDGE);
_gColSize[0] = (int)(GetSystemMetrics (SM_CXSCREEN) * 0.75);
_gColSize[1] = (int)(GetSystemMetrics (SM_CXSCREEN) * 0.25);
// BuildColumns(2, _gColSize, _gColText);
// m_ListCtrl.InsertItem(0, "Some sample text.");
// m_ListCtrl.SetItem(0,1,LVIF_TEXT,"More text.",
// 0,LVIF_TEXT,LVIF_TEXT,0);
return 0;
}
void CResultView::Add_Result_Msg(CString strMsg)
{
int nIndex;
CTime tmNow;
CString strTime;
nIndex = m_ListCtrl.GetItemCount ()+1;
m_ListCtrl.InsertItem(nIndex, strMsg);
tmNow = CTime::GetCurrentTime ();
strTime = tmNow.Format ("%H:%M:%S");
m_ListCtrl.SetItemText(nIndex-1,1,(LPSTR)(LPCTSTR)strTime);
}
void CResultView::BuildColumns()
{
int nCols = 2;
//insert columns
int i;
LV_COLUMN lvc;
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
CString strTemp;
for(i = 0; i < nCols; i++)
{
lvc.iSubItem = i;
strTemp.LoadString(_gColText[i]);
lvc.pszText = (char*)(LPCTSTR)strTemp;
lvc.cx = _gColSize[i];
lvc.fmt = LVCFMT_LEFT;
m_ListCtrl.InsertColumn(i,&lvc);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -