MyBarBottom.cpp
资源名称:matcher.rar [点击查看]
上传用户:quan1896
上传日期:2013-04-17
资源大小:94k
文件大小:2k
源码类别:
2D图形编程
开发平台:
Visual C++
- // MyBarBottom.cpp : implementation file
- //
- #include "stdafx.h"
- #include "matcher.h"
- #include "MyBarBottom.h"
- #include "Resource.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CMyBarBottom
- CMyBarBottom::CMyBarBottom()
- {
- }
- CMyBarBottom::~CMyBarBottom()
- {
- }
- BEGIN_MESSAGE_MAP(CMyBarBottom, CCJControlBar)
- //{{AFX_MSG_MAP(CMyBarBottom)
- ON_WM_CREATE()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CMyBarBottom message handlers
- static int _gColText[] = { IDS_COL_1, IDS_COL_2 };
- static int _gColSize[] = { 80, 580 };
- int CMyBarBottom::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 CMyBarLeftn");
- return -1;
- }
- SetChild(&m_ListCtrl);
- m_ListCtrl.ModifyStyleEx(0, WS_EX_STATICEDGE);
- 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 CMyBarBottom::BuildColumns(int nCols, int * nWidth, int * iCol)
- {
- ASSERT(nCols);
- ASSERT(nWidth);
- ASSERT(iCol);
- ASSERT(m_ListCtrl);
- //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(iCol[i]);
- lvc.pszText = (char*)(LPCTSTR)strTemp;
- lvc.cx = nWidth[i];
- lvc.fmt = LVCFMT_LEFT;
- m_ListCtrl.InsertColumn(i,&lvc);
- }
- }