123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714 |
- // ListCtrlCl.cpp : 实现文件
- //
- #include "stdafx.h"
- #include "ListCtrlCl.h"
- #include ".\listctrlcl.h"
- #define IDC_EDITB 4000
- #define IDC_BTN 5000
- #define IDC_COMB 6000
- struct stColor
- {
- int nRow;
- int nCol;
- COLORREF rgb;
- };
- // CListCtrlCl
- IMPLEMENT_DYNAMIC(CListCtrlCl, CListCtrl)
- CListCtrlCl::CListCtrlCl()
- : m_nRowHeight(0)
- , m_fontHeight(12)
- , m_fontWith(0)
- {
- m_color = RGB(0,0,0);
- InitializeCriticalSection(&m_SECTION);
- m_nRow=-1;
- m_nCol=-1;
- m_nRowOld=-1;
- m_nColOld=-1;
- m_nRowMin = 0;
- m_nRowMax = 99999;
- m_nColMin = 0;
- m_nColMax = 99999;
- memset( m_nItemType,0,100*4 );
- }
- CListCtrlCl::~CListCtrlCl()
- {
- for (POSITION pos = m_ptrListCol.GetHeadPosition();pos!=NULL;)
- {
- stColor *pColor = (stColor*)m_ptrListCol.GetNext(pos);
- delete pColor;
- pColor = NULL;
- }
- m_ptrListCol.RemoveAll();
- for (POSITION pos = m_ptrListItem.GetHeadPosition();pos!=NULL;)
- {
- stColor *pColor = (stColor*)m_ptrListItem.GetNext(pos);
- delete pColor;
- pColor = NULL;
- }
- m_ptrListItem.RemoveAll();
- for (POSITION pos = m_colTextColor.GetHeadPosition();pos!=NULL;)
- {
- stColor *pColor = (stColor*)m_colTextColor.GetNext(pos);
- delete pColor;
- pColor = NULL;
- }
- m_colTextColor.RemoveAll();
- for (POSITION pos = m_ItemTextColor.GetHeadPosition();pos!=NULL;)
- {
- stColor *pColor = (stColor*)m_ItemTextColor.GetNext(pos);
- delete pColor;
- pColor = NULL;
- }
- m_ItemTextColor.RemoveAll();
- DeleteCriticalSection( &m_SECTION );
- }
- BEGIN_MESSAGE_MAP(CListCtrlCl, CListCtrl)
- ON_WM_MEASUREITEM()
- ON_WM_MEASUREITEM_REFLECT()
- ON_NOTIFY_REFLECT(LVN_DELETEALLITEMS, OnLvnDeleteallitems)
- ON_WM_LBUTTONDOWN()
- ON_WM_KILLFOCUS()
- // ON_WM_DELETEITEM()
- ON_NOTIFY_REFLECT(LVN_DELETEITEM, OnLvnDeleteitem)
- END_MESSAGE_MAP()
- // CListCtrlCl 消息处理程序
- void CListCtrlCl::PreSubclassWindow()
- {
- // TODO: 在此添加专用代码和/或调用基类
- ModifyStyle(0,LVS_OWNERDRAWFIXED);
- CListCtrl::PreSubclassWindow();
- CHeaderCtrl *pHeader = GetHeaderCtrl();
- m_Header.SubclassWindow(pHeader->GetSafeHwnd());
- }
- void CListCtrlCl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
- {
- // TODO: 添加您的代码以绘制指定项
- //EnterCriticalSection( &m_SECTION );
- TCHAR lpBuffer[256];
- LV_ITEM lvi;
- lvi.mask = LVIF_TEXT | LVIF_PARAM ;
- lvi.iItem = lpDrawItemStruct->itemID ;
- lvi.iSubItem = 0;
- lvi.pszText = lpBuffer ;
- lvi.cchTextMax = sizeof(lpBuffer);
- VERIFY(GetItem(&lvi));
- LV_COLUMN lvc, lvcprev ;
- ::ZeroMemory(&lvc, sizeof(lvc));
- ::ZeroMemory(&lvcprev, sizeof(lvcprev));
- lvc.mask = LVCF_WIDTH | LVCF_FMT;
- lvcprev.mask = LVCF_WIDTH | LVCF_FMT;
- CDC* pDC;
- pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
- CRect rtClient;
- GetClientRect(&rtClient);
- for ( int nCol=0; GetColumn(nCol, &lvc); nCol++)
- {
- if ( nCol > 0 )
- {
- // Get Previous Column Width in order to move the next display item
- GetColumn(nCol-1, &lvcprev) ;
- lpDrawItemStruct->rcItem.left += lvcprev.cx ;
- lpDrawItemStruct->rcItem.right += lpDrawItemStruct->rcItem.left;
- }
- CRect rcItem;
- if (!GetSubItemRect(lpDrawItemStruct->itemID,nCol,LVIR_LABEL,rcItem))
- continue;
- ::ZeroMemory(&lvi, sizeof(lvi));
- lvi.iItem = lpDrawItemStruct->itemID;
- lvi.mask = LVIF_TEXT | LVIF_PARAM;
- lvi.iSubItem = nCol;
- lvi.pszText = lpBuffer;
- lvi.cchTextMax = sizeof(lpBuffer);
- VERIFY(GetItem(&lvi));
- CRect rcTemp;
- rcTemp = rcItem;
- if (nCol==0)
- {
- rcTemp.left -=2;
- }
- if ( lpDrawItemStruct->itemState & ODS_SELECTED )
- {
- pDC->FillSolidRect(&rcTemp, RGB(86,159,255));//GetSysColor(COLOR_HIGHLIGHT)) ;
- pDC->SetTextColor(GetSysColor(COLOR_HIGHLIGHTTEXT)) ;
- }
- else
- {
- COLORREF color;
- color = GetBkColor();
- pDC->FillSolidRect(rcTemp,color);
- if (FindColColor(nCol,color))
- {
- pDC->FillSolidRect(rcTemp,color);
- }
- if (FindItemColor(nCol,lpDrawItemStruct->itemID,color))
- {
- pDC->FillSolidRect(rcTemp,color);
- }
-
- //pDC->SetTextColor(m_color);
- }
- pDC->SelectObject(GetStockObject(DEFAULT_GUI_FONT));
- UINT uFormat = DT_CENTER ;
- if (m_Header.m_Format[nCol]=='0')
- {
- uFormat = DT_LEFT;
- }
- else if (m_Header.m_Format[nCol]=='1')
- {
- uFormat = DT_CENTER;
- }
- else if (m_Header.m_Format[nCol]=='2')
- {
- uFormat = DT_RIGHT;
- }
- TEXTMETRIC metric;
- pDC->GetTextMetrics(&metric);
- int ofst;
- ofst = rcItem.Height() - metric.tmHeight;
- rcItem.OffsetRect(0,ofst/2);
- pDC->SetTextColor(m_color);
- COLORREF color;
- if (FindColTextColor(nCol,color))
- {
- pDC->SetTextColor(color);
- }
- if (FindItemTextColor(nCol,lpDrawItemStruct->itemID,color))
- {
- pDC->SetTextColor(color);
- }
- CFont nFont ,* nOldFont;
- nFont.CreateFont(m_fontHeight,m_fontWith,0,0,0,FALSE,FALSE,0,0,0,0,0,0,_TEXT("宋体"));//创建字体
- nOldFont = pDC->SelectObject(&nFont);
- DrawText(lpDrawItemStruct->hDC, lpBuffer, strlen(lpBuffer),
- &rcItem, uFormat) ;
- pDC->SelectStockObject(SYSTEM_FONT) ;
- DeleteObject( nFont );
- }
- //ReleaseDC( pDC );
- //LeaveCriticalSection( &m_SECTION );
- }
- void CListCtrlCl::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
- {
- // TODO: 在此添加消息处理程序代码和/或调用默认值
- CListCtrl::OnMeasureItem(nIDCtl, lpMeasureItemStruct);
- }
- void CListCtrlCl::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct)
- {
- if (m_nRowHeight>0)
- {
- lpMeasureItemStruct->itemHeight = m_nRowHeight;
- }
- }
- int CListCtrlCl::InsertColumn(int nCol, LPCTSTR lpszColumnHeading, int nFormat /* = LVCFMT_LEFT */, int nWidth /* = -1 */, int nSubItem /* = -1 */)
- {
- m_Header.m_HChar.Add(lpszColumnHeading);
- if (nFormat==LVCFMT_LEFT)
- {
- m_Header.m_Format = m_Header.m_Format + "0";
- }
- else if (nFormat==LVCFMT_CENTER)
- {
- m_Header.m_Format = m_Header.m_Format + "1";
- }
- else if (nFormat==LVCFMT_RIGHT)
- {
- m_Header.m_Format = m_Header.m_Format + "2";
- }
- else
- {
- m_Header.m_Format = m_Header.m_Format + "1";
- }
- return CListCtrl::InsertColumn(nCol,lpszColumnHeading,nFormat,nWidth,nSubItem);
- }
- // Gradient - 渐变系数,立体背景用,不用渐变设为0
- void CListCtrlCl::SetHeaderBKColor(int R, int G, int B, int Gradient) //设置表头背景色
- {
- m_Header.m_R = R;
- m_Header.m_G = G;
- m_Header.m_B = B;
- m_Header.m_Gradient = Gradient;
- }
- // 设置表头高度
- void CListCtrlCl::SetHeaderHeight(float Height) //设置表头高度
- {
- m_Header.m_Height = Height;
- }
- bool CListCtrlCl::FindColColor(int col,COLORREF &color) //查找列颜色
- {
- //EnterCriticalSection( &m_SECTION );
- int flag = 0;
- for (POSITION pos = m_ptrListCol.GetHeadPosition();pos!=NULL;)
- {
- stColor *pColor = (stColor*)m_ptrListCol.GetNext(pos);
- if (pColor->nCol==col)
- {
- flag = 1;
- color = pColor->rgb;
- break;
- }
- }
- //LeaveCriticalSection( &m_SECTION );
- if (1==flag)
- {
- return true;
- }
- return false;
- }
- bool CListCtrlCl::FindItemColor(int col,int row,COLORREF &color) //查找颜色
- {
- //EnterCriticalSection( &m_SECTION );
- int flag = 0;
- for (POSITION pos = m_ptrListItem.GetHeadPosition();pos!=NULL;)
- {
- stColor *pColor = (stColor*)m_ptrListItem.GetNext(pos);
- if (pColor->nCol==col&&pColor->nRow==row)
- {
- flag = 1;
- color = pColor->rgb;
- break;
- }
- }
- //LeaveCriticalSection( &m_SECTION );
- if (1==flag)
- {
- return true;
- }
- return false;
- }
- void CListCtrlCl::SetColColor(int col,COLORREF color) //设置列颜色
- {
- stColor *pColor = new stColor;
- pColor->nCol = col;
- pColor->rgb = color;
- m_ptrListCol.AddTail(pColor);
- }
- void CListCtrlCl::SetItemColor(int col,int row,COLORREF color) //设置格子颜色
- {
- for (POSITION pos = m_ptrListItem.GetHeadPosition();pos!=NULL;)
- {
- POSITION pos1 = pos;
- stColor *pColor = (stColor*)m_ptrListItem.GetNext(pos);
- if (pColor->nCol==col&&pColor->nRow==row)
- {
- delete pColor;
- pColor = NULL;
- m_ptrListItem.RemoveAt( pos1 );
- break;
- }
- }
- stColor *pColor = new stColor;
- pColor->nCol = col;
- pColor->nRow = row;
- pColor->rgb = color;
- m_ptrListItem.AddTail(pColor);
- }
- void CListCtrlCl::SetRowHeigt(int nHeight) //高置行高
- {
- m_nRowHeight = nHeight;
- CRect rcWin;
- GetWindowRect(&rcWin);
- WINDOWPOS wp;
- wp.hwnd = m_hWnd;
- wp.cx = rcWin.Width();
- wp.cy = rcWin.Height();
- wp.flags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER;
- SendMessage(WM_WINDOWPOSCHANGED, 0, (LPARAM)&wp);
- }
- void CListCtrlCl::SetHeaderFontHW(int nHeight,int nWith) //设置头部字体宽和高
- {
- m_Header.m_fontHeight = nHeight;
- m_Header.m_fontWith = nWith;
- }
- void CListCtrlCl::SetHeaderTextColor(COLORREF color) //设置头部字体颜色
- {
- m_Header.m_color = color;
- }
- BOOL CListCtrlCl::SetTextColor(COLORREF cr) //设置字体颜色
- {
- m_color = cr;
- return TRUE;
- }
- void CListCtrlCl::SetFontHW(int nHeight,int nWith) //设置字体高和宽
- {
- m_fontHeight = nHeight;
- m_fontWith = nWith;
- }
- void CListCtrlCl::SetColTextColor(int col,COLORREF color)
- {
- stColor *pColor = new stColor;
- pColor->nCol = col;
- pColor->rgb = color;
- m_colTextColor.AddTail(pColor);
- }
- bool CListCtrlCl::FindColTextColor(int col,COLORREF &color)
- {
- //EnterCriticalSection( &m_SECTION );
- int flag = 0;
- for (POSITION pos = m_colTextColor.GetHeadPosition();pos!=NULL;)
- {
- stColor *pColor = (stColor*)m_colTextColor.GetNext(pos);
- if (pColor->nCol==col)
- {
- flag = 1;
- color = pColor->rgb;
- break;
- }
- }
- //LeaveCriticalSection( &m_SECTION );
- if (1==flag)
- {
- return true;
- }
- return false;
- }
- bool CListCtrlCl::FindItemTextColor(int col,int row,COLORREF &color)
- {
- //EnterCriticalSection( &m_SECTION );
- int flag = 0;
- for (POSITION pos = m_ItemTextColor.GetHeadPosition();pos!=NULL;)
- {
- stColor *pColor = (stColor*)m_ItemTextColor.GetNext(pos);
- if (pColor->nCol==col&&pColor->nRow==row)
- {
- flag = 1;
- color = pColor->rgb;
- break;
- }
- }
- //LeaveCriticalSection( &m_SECTION );
- if (1==flag)
- {
- return true;
- }
- return false;
- }
- void CListCtrlCl::SetItemTextColor(int col,int row,COLORREF color)
- {
- stColor *pColor = new stColor;
- pColor->nCol = col;
- pColor->nRow = row;
- pColor->rgb = color;
- m_ItemTextColor.AddTail(pColor);
- }
- void CListCtrlCl::OnLvnDeleteallitems(NMHDR *pNMHDR, LRESULT *pResult)
- {
- LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
- // TODO: 在此添加控件通知处理程序代码
- //EnterCriticalSection( &m_SECTION );
- for (POSITION pos = m_ptrListCol.GetHeadPosition();pos!=NULL;)
- {
- stColor *pColor = (stColor*)m_ptrListCol.GetNext(pos);
- delete pColor;
- pColor = NULL;
-
- }
- m_ptrListCol.RemoveAll();
- for (POSITION pos = m_ptrListItem.GetHeadPosition();pos!=NULL;)
- {
- stColor *pColor = (stColor*)m_ptrListItem.GetNext(pos);
- delete pColor;
- pColor = NULL;
- }
- m_ptrListItem.RemoveAll();
- for (POSITION pos = m_colTextColor.GetHeadPosition();pos!=NULL;)
- {
- stColor *pColor = (stColor*)m_colTextColor.GetNext(pos);
- delete pColor;
- pColor = NULL;
- }
- m_colTextColor.RemoveAll();
- for (POSITION pos = m_ItemTextColor.GetHeadPosition();pos!=NULL;)
- {
- stColor *pColor = (stColor*)m_ItemTextColor.GetNext(pos);
- delete pColor;
- pColor = NULL;
- }
- m_ItemTextColor.RemoveAll();
- //LeaveCriticalSection( &m_SECTION );
- *pResult = 0;
- }
- void CListCtrlCl::Edit()
- {
- EndEdit();
- CRect rect;
-
- if(GetSubItemRect(m_nRow,m_nCol,LVIR_LABEL,rect)==FALSE)
- return;
- int sty=WS_CHILD|WS_CLIPSIBLINGS|WS_EX_TOOLWINDOW|WS_BORDER;
- //int sty=WS_CHILD|WS_EX_TOOLWINDOW; //设置编辑框样式
- //设置编辑框样式
- if(m_edit.Create(sty,rect,this,IDC_EDITB)==FALSE)
- return;
- CString txt=GetItemText(m_nRow,m_nCol);
- m_edit.SetWindowText(txt);//设置编辑框的内容
- m_edit.SetFocus();
- m_edit.SetSel(0,-1);
- m_edit.ShowWindow(SW_SHOW);//显示编辑框
- Sleep(100);
- }
- void CListCtrlCl::EndEdit()
- {
- if( m_edit )//if(m_nRowOld!=-1&&m_nColOld!=-1)//判断是否为初始时
- {
- CString str;
- m_edit.GetWindowText(str);
- SetItemText(m_nRowOld,m_nColOld,str);//设置为编辑后的文件内容
- m_edit.DestroyWindow();
- }
- }
- void CListCtrlCl::Btn()
- {
- EndBtn();
- CRect rect;
-
- if(GetSubItemRect(m_nRow,m_nCol,LVIR_LABEL,rect)==FALSE)
- return;
- int sty=WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON;
- //int sty=WS_CHILD|WS_EX_TOOLWINDOW; //设置编辑框样式
- //设置编辑框样式
- rect.left = rect.right-20;
- CString txt=GetItemText(m_nRow,m_nCol);
- if(m_Btn.Create("...",sty,rect,this,IDC_BTN)==FALSE)
- return;
- m_Btn.ShowWindow(SW_SHOW);//显示编辑框
- //Sleep(100);
- }
- void CListCtrlCl::EndBtn()
- {
- if( m_Btn )
- m_Btn.DestroyWindow();
- }
- void CListCtrlCl::Comb()
- {
- EndComb();
- CRect rect;
-
- if(GetSubItemRect(m_nRow,m_nCol,LVIR_LABEL,rect)==FALSE)
- return;
- int sty=WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST;
- //int sty=WS_CHILD|WS_EX_TOOLWINDOW; //设置编辑框样式
- //设置编辑框样式
- //rect.left = rect.right-20;
- if(m_Comb.Create(sty,rect,this,IDC_COMB)==FALSE)
- return;
- m_Comb.SetWindowPos(NULL, rect.left, rect.top, rect.Width(), 500, SWP_NOZORDER);
- m_Comb.ShowWindow(SW_SHOW);//显示编辑框
- CString txt=GetItemText(m_nRow,m_nCol);
- int nSetCur=0;
- CString str;
- for( int i=0;i<m_saCombData[m_nCol].GetCount();i++ )
- {
- str = m_saCombData[m_nCol].GetAt( i );
- m_Comb.InsertString( i,str );
- if( txt==str )
- nSetCur=i;
- }
- m_Comb.SetCurSel(nSetCur);
- //Sleep(100);
- }
- void CListCtrlCl::EndComb()
- {
- if( m_Comb )
- {
- CString str;
- m_Comb.GetLBText( m_Comb.GetCurSel(),str );
- SetItemText(m_nRowOld,m_nColOld,str);
- m_Comb.DestroyWindow();
- }
- }
- void CListCtrlCl::EndAll()
- {
- EndBtn();
- EndEdit();
- EndComb();
- }
- void CListCtrlCl::SetItemType( int iCol,int iType )
- {
- m_nItemType[iCol] = iType;
- }
- void CListCtrlCl::SetRange( int iRowMin,int iRowMax,int iColMin,int iColMax )
- {
- m_nRowMin = iRowMin;
- m_nRowMax = iRowMax;
- m_nColMin = iColMin;
- m_nColMax = iColMax;
- }
- void CListCtrlCl::OnLButtonDown(UINT nFlags, CPoint point)
- {
- LVHITTESTINFO testinfo;
- testinfo.pt.x=point.x;
- testinfo.pt.y=point.y;
- testinfo.flags=LVHT_ONITEMLABEL;//强调点击必是标题
- if(SubItemHitTest(&testinfo)<0)
- return;
- m_nRow=testinfo.iItem;//得到行号
- m_nCol=testinfo.iSubItem;//得到列号
- if( m_nRow<m_nRowMin || m_nRow>m_nRowMax || m_nCol<m_nColMin || m_nCol>m_nColMax )
- return;
- if(m_nRow==m_nRowOld&&m_nCol==m_nColOld)//判断是否是前一点击的行列
- return;
- else
- {
- EndAll();
- switch( m_nItemType[m_nCol] )
- {
- case 1:
- Edit();
- break;
- case 2:
- Btn();
- break;
- case 3:
- Comb();
- break;
- }
-
- m_nRowOld=m_nRow;
- m_nColOld=m_nCol;
- }
- CListCtrl::OnLButtonDown(nFlags, point);
- }
- BOOL CListCtrlCl::OnCommand(WPARAM wParam, LPARAM lParam)
- {
- switch( HIWORD(wParam) )
- {
- case BN_CLICKED:
- {
- //test only!!
- //sprintf( ss,"%d",LOWORD(wParam) );
- //MessageBox(ss);
- //根据不同的 ID 做不同的处理...
- switch( LOWORD(wParam) )
- {
- case IDC_BTN:
- ::SendMessage( this->GetParent()->GetSafeHwnd(),WM_MY_BTN,0,0 );
- break;
- }
- }
- break;
- }
- return CListCtrl::OnCommand(wParam, lParam);
- }
- void CListCtrlCl::OnKillFocus(CWnd* pNewWnd)
- {
- CListCtrl::OnKillFocus(pNewWnd);
- // TODO: 在此处添加消息处理程序代码
- //EndAll();
- }
- void CListCtrlCl::OnLvnDeleteitem(NMHDR *pNMHDR, LRESULT *pResult)
- {
- LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
- // TODO: 在此添加控件通知处理程序代码
- //Item颜色
- for (POSITION pos = m_ptrListItem.GetHeadPosition();pos!=NULL;)
- {
- POSITION pos1 = pos;
- stColor *pColor = (stColor*)m_ptrListItem.GetNext(pos);
- if( pColor->nRow==pNMLV->iItem )
- {
- delete pColor;
- pColor = NULL;
- m_ptrListItem.RemoveAt( pos1 );
- }
- }
- for (POSITION pos = m_ptrListItem.GetHeadPosition();pos!=NULL;)
- {
- POSITION pos1 = pos;
- stColor *pColor = (stColor*)m_ptrListItem.GetNext(pos);
- if( pColor->nRow>pNMLV->iItem )
- {
- pColor->nRow--;
- }
- }
- //Item文本颜色
- for (POSITION pos = m_ItemTextColor.GetHeadPosition();pos!=NULL;)
- {
- POSITION pos1 = pos;
- stColor *pColor = (stColor*)m_ItemTextColor.GetNext(pos);
- if( pColor->nRow==pNMLV->iItem )
- {
- delete pColor;
- pColor = NULL;
- m_ItemTextColor.RemoveAt( pos1 );
- }
- }
- for (POSITION pos = m_ItemTextColor.GetHeadPosition();pos!=NULL;)
- {
- POSITION pos1 = pos;
- stColor *pColor = (stColor*)m_ItemTextColor.GetNext(pos);
- if( pColor->nRow>pNMLV->iItem )
- {
- pColor->nRow--;
- }
- }
- *pResult = 0;
- }
|