資源簡介
在listctrl中添加edit控件和combo box控件
vc6編譯通過,封裝成類便于復用

代碼片段和文件信息
/*******************************************************************************
Author :?Aravindan?Premkumar
Unregistered?Copyright?2003 :?Aravindan?Premkumar
All?Rights?Reserved
This?piece?of?code?does?not?have?any?registered?copyright?and?is?free?to?be?
used?as?necessary.?The?user?is?free?to?modify?as?per?the?requirements.?As?a
fellow?developer?all?that?I?expect?and?request?for?is?to?be?given?the?
credit?for?intially?developing?this?reusable?code?by?not?removing?my?name?as?
the?author.
*******************************************************************************/
#include?“stdafx.h“
#include?“ComboListCtrl.h“
#include?“InPlaceCombo.h“
#include?“InPlaceEdit.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
//#defines
#define?FIRST_COLUMN 0
#define?MIN_COLUMN_WIDTH 10
#define?MAX_DROP_DOWN_ITEM_COUNT 10
/////////////////////////////////////////////////////////////////////////////
//?CComboListCtrl
CComboListCtrl::CComboListCtrl()
{
m_iColumnCounts?=?0;
m_ComboSupportColumnsList.RemoveAll();
m_ReadOnlyColumnsList.RemoveAll();
m_strValidEditCtrlChars.Empty();
m_dwEditCtrlstyle?=?ES_AUTOHSCROLL?|?ES_AUTOVSCROLL?|?ES_LEFT?|?ES_NOHIDESEL;
m_dwDropDownCtrlstyle?=?WS_BORDER?|?WS_CHILD?|?WS_VISIBLE?|?ES_AUTOHSCROLL?|?ES_AUTOVSCROLL?|?
CBS_DROPDOWNLIST?|?CBS_DISABLENOSCROLL;
}
CComboListCtrl::~CComboListCtrl()
{
CInPlaceCombo::DeleteInstance();
CInPlaceEdit::DeleteInstance();??
}
BEGIN_MESSAGE_MAP(CComboListCtrl?CListCtrl)
//{{AFX_MSG_MAP(CComboListCtrl)
ON_WM_HSCROLL()
ON_WM_VSCROLL()
ON_WM_LBUTTONDOWN()
ON_NOTIFY_REFLECT(LVN_ENDLABELEDIT?OnEndLabelEdit)
ON_NOTIFY_REFLECT(LVN_BEGINLABELEDIT?OnBeginLabelEdit)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//?CComboListCtrl?message?handlers
CInPlaceCombo*?CComboListCtrl::ShowInPlaceList(int?iRowIndex?int?iColumnIndex?CStringList&?rComboItemsList?
???CString?strCurSelecetion?/*=?““*/?int?iSel?/*=?-1*/)
{
//?The?returned?obPointer?should?not?be?saved
//?Make?sure?that?the?item?is?visible
if?(!EnsureVisible(iRowIndex?TRUE))
{
return?NULL;
}
//?Make?sure?that?iColumnIndex?is?valid?
CHeaderCtrl*?pHeader?=?static_cast?(GetDlgItem(FIRST_COLUMN));
int?iColumnCount?=?pHeader->GetItemCount();
if?(iColumnIndex?>=?iColumnCount?||?GetColumnWidth(iColumnIndex)? {
return?NULL;
}
//?Calculate?the?rectangle?specifications?for?the?combo?box
CRect?obCellRect(0?0?0?0);
CalculateCellRect(iColumnIndex?iRowIndex?obCellRect);
int?iHeight?=?obCellRect.Height();??
int?iCount?=?(int?)rComboItemsList.GetCount();
iCount?=?(iCount? iCount?+?MAX_DROP_DOWN_ITEM_COUNT?:?(MAX_DROP_DOWN_ITEM_COUNT?+?1);?
obCellRect.bottom?+=?iHeight?*?iCount;?
//?Create?the?in
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1668??2004-07-15?14:23??TestComboListCtrl\TestComboListCtrlDlg.h
?????文件???????7084??2004-07-15?14:39??TestComboListCtrl\TestComboListCtrlDlg.cpp
?????文件???????5713??2004-07-15?14:37??TestComboListCtrl\TestComboListCtrl.rc
?????文件???????1397??2004-09-06?16:19??TestComboListCtrl\TestComboListCtrl.clw
?????文件???????3777??2004-07-15?14:11??TestComboListCtrl\ReadMe.txt
?????文件???????1445??2004-07-15?14:11??TestComboListCtrl\TestComboListCtrl.h
?????文件???????2217??2004-07-15?14:11??TestComboListCtrl\TestComboListCtrl.cpp
?????文件???????4765??2004-07-15?14:39??TestComboListCtrl\TestComboListCtrl.dsp
?????文件???????1054??2004-07-15?14:11??TestComboListCtrl\StdAfx.h
?????文件????????219??2004-07-15?14:11??TestComboListCtrl\StdAfx.cpp
?????文件????????409??2004-07-15?14:11??TestComboListCtrl\res\TestComboListCtrl.rc2
?????文件???????1078??2004-07-15?14:11??TestComboListCtrl\res\TestComboListCtrl.ico
?????目錄??????????0??2004-07-15?14:11??TestComboListCtrl\res
?????文件????????557??2004-07-15?14:11??TestComboListCtrl\TestComboListCtrl.dsw
?????文件???????4487??2003-12-24?16:11??TestComboListCtrl\InPlaceCombo.cpp
?????文件???????2853??2003-12-24?16:11??TestComboListCtrl\InPlaceCombo.h
?????文件???????5024??2004-07-14?09:26??TestComboListCtrl\InPlaceEdit.cpp
?????文件???????2819??2004-07-14?09:27??TestComboListCtrl\InPlaceEdit.h
?????文件??????12216??2004-07-14?17:11??TestComboListCtrl\ComboListCtrl.cpp
?????文件???????5002??2004-07-14?17:06??TestComboListCtrl\ComboListCtrl.h
?????文件????????268??2004-09-06?16:04??TestComboListCtrl\TestComboListCtrl.plg
?????文件????????787??2004-07-15?14:22??TestComboListCtrl\Resource.h
?????文件??????66560??2004-09-06?16:19??TestComboListCtrl\TestComboListCtrl.ncb
?????目錄??????????0??2004-09-06?15:00??TestComboListCtrl\Debug
?????文件??????21280??2004-09-06?15:02??TestComboListCtrl\TestComboListCtrl.aps
?????文件?????113664??2004-09-06?16:19??TestComboListCtrl\TestComboListCtrl.opt
?????目錄??????????0??2004-07-15?14:11??TestComboListCtrl
-----------?---------??----------?-----??----
???????????????266343????????????????????27
............此處省略0個文件信息
評論
共有 條評論