www.pudn.com > speech1.rar > ViewWork.cpp
// ViewWork.cpp : implementation file
//
#include "stdafx.h"
#include "Specch.h"
#include "ViewWork.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CViewWork dialog
CViewWork::CViewWork(CWnd* pParent /*=NULL*/)
: CDialog(CViewWork::IDD, pParent)
{
//{{AFX_DATA_INIT(CViewWork)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CViewWork::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CViewWork)
DDX_Control(pDX, IDC_LIST1, m_list);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CViewWork, CDialog)
//{{AFX_MSG_MAP(CViewWork)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CViewWork message handlers
BOOL CViewWork::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_imageList.Create(16,16,TRUE,2,2);
m_imageList.Add(AfxGetApp()->LoadIcon(IDI_ICON2));
m_list.SetImageList(&m_imageList,LVSIL_SMALL);
m_font.CreateFont(16, 0,0,0,FW_NORMAL, 0,0,0,
DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial");
m_list.SetFont(&m_font);
/*-----------------------------------------------------------*/
m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
m_list.SetBkColor(RGB(247,247,255));
m_list.SetTextColor(RGB(0,0,255));
m_list.SetTextBkColor(RGB(247,247,255));
m_list.InsertColumn(0, " 时间", LVCFMT_LEFT, 150);
m_list.InsertColumn(1, " 工作备忘", LVCFMT_LEFT, 500);
POSITION timePos = m_timeList.GetHeadPosition() ;
POSITION workPos = m_strWorkList.GetHeadPosition() ;
for (int n = 0 ; timePos != NULL ; n++)
{
CString strTime ;
strTime.Format("%d-%d-%d %d:%d" , m_timeList.GetAt(timePos).GetYear() , m_timeList.GetAt(timePos).GetMonth() ,
m_timeList.GetAt(timePos).GetDay() , m_timeList.GetAt(timePos).GetHour() ,
m_timeList.GetAt(timePos).GetMinute()) ;
m_list.InsertItem(n , strTime) ;
m_list.SetItemText(n , 1 , m_strWorkList.GetAt(workPos)) ;
m_timeList.GetNext(timePos) ;
m_strWorkList.GetNext(workPos) ;
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
CList* CViewWork::GetTimList()
{
return &m_timeList ;
}
CList* CViewWork::GetWorkList()
{
return &m_strWorkList ;
}
void CViewWork::SetTimeList(CList &timeList)
{
POSITION pos = timeList.GetHeadPosition() ;
for(; pos != NULL ; timeList.GetNext(pos))
{
m_timeList.AddTail(timeList.GetAt(pos)) ;
}
}
void CViewWork::SetWorkList(CList &workList)
{
POSITION pos = workList.GetHeadPosition() ;
for (; pos != NULL ; workList.GetNext(pos))
{
m_strWorkList.AddTail(workList.GetAt(pos)) ;
}
}