青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

啤酒

一個空白者

 

CListCtrl使用技巧

//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
排序算發
// SortTextItems	- Sort the list based on column text// Returns		- Returns truefor success// nCol			- column that contains the text to be sorted// bAscending		- indicate sort order// low			- row to start scanning from - default row is 0// high			- row to end scan. -1 indicates last row
字符串
/////////////////////////// BOOL CMyListCtrl::SortTextItems( int nCol, BOOL bAscending,? int low /*= 0*, int high /*= -1* ) { if( nCol >= ((CHeaderCtrl*)GetDlgItem(0))->GetItemCount() ) return FALSE; if( high == -1 ) high = GetItemCount() - 1; int lo = low; int hi = high; CString midItem; if( hi <= lo ) return FALSE; midItem = GetItemText( (lo+hi)/2, nCol ); // loop through the list until indices crosswhile( lo <= hi ) { // rowText will hold all column text for one row CStringArray rowText; // find the first element that is greater than or equal to?// the partition element starting from the left Index.if( bAscending ) while( ( lo < high ) && ( GetItemText(lo, nCol) < midItem ) ) ++lo; elsewhile( ( lo < high ) && ( GetItemText(lo, nCol) > midItem ) ) ++lo; // find an element that is smaller than or equal to?// the partition element starting from the right Index.if( bAscending ) while( ( hi > low ) && ( GetItemText(hi, nCol) > midItem ) ) --hi; elsewhile( ( hi > low ) && ( GetItemText(hi, nCol) < midItem ) ) --hi; // if the indexes have not crossed, swap// and if the items are not equalif( lo <= hi ) { // swap only if the items are not equalif( GetItemText(lo, nCol) != GetItemText(hi, nCol)) { // swap the rows LV_ITEM lvitemlo, lvitemhi; int nColCount =? ((CHeaderCtrl*)GetDlgItem(0))->GetItemCount(); rowText.SetSize( nColCount ); int i; for( i=0; i<nColCount; i++) rowText[i] = GetItemText(lo, i); lvitemlo.mask = LVIF_IMAGE | LVIF_PARAM | LVIF_STATE; lvitemlo.iItem = lo; lvitemlo.iSubItem = 0; lvitemlo.stateMask = LVIS_CUT | LVIS_DROPHILITED |? LVIS_FOCUSED |? LVIS_SELECTED |? LVIS_OVERLAYMASK | LVIS_STATEIMAGEMASK; lvitemhi = lvitemlo; lvitemhi.iItem = hi; GetItem( &lvitemlo ); GetItem( &lvitemhi ); for( i=0; i<nColCount; i++) SetItemText(lo, i, GetItemText(hi, i)); lvitemhi.iItem = lo; SetItem( &lvitemhi ); for( i=0; i<nColCount; i++) SetItemText(hi, i, rowText[i]); lvitemlo.iItem = hi; SetItem( &lvitemlo ); } ++lo; --hi; } } // If the right index has not reached the left side of array// must now sort the left partition.if( low < hi ) SortTextItems( nCol, bAscending , low, hi); // If the left index has not reached the right side of array// must now sort the right partition.if( lo < high ) SortTextItems( nCol, bAscending , lo, high ); return TRUE; }

//////////////////////////////////////////////////////////

數值:
bool CMyListCtrl::SortNumericItems( int nCol, BOOL bAscending,int low/*=0*, int high/*=-1* )
{
	if( nCol >= ((CHeaderCtrl*)GetDlgItem(0))->GetItemCount() )
		return FALSE;

	if( high == -1 ) high = GetItemCount() - 1;

	int lo = low;
	int hi = high;
	CString midItem;

	if( hi <= lo )
	      return FALSE;

	midItem = GetItemText( (lo+hi)/2, nCol );

	// loop through the list until indices crosswhile( lo <= hi )
	{
 		// rowText will hold all column text for one row
 		CStringArray rowText;

 		// find the first element that is greater than or equal to// the partition element starting from the left Index.if( bAscending )
  			//while( ( lo < high ) && (atoi(GetItemText(lo, nCol)) < midItem ) )
			/*!!!*  while( ( lo < high ) && ( CmpItems( GetItemText(lo, nCol) , midItem, nCol) < 0 ) )
   				++lo;
 		else//while( ( lo < high ) && (atoi(GetItemText(lo, nCol)) > midItem ) )
			/*!!!*  while( ( lo < high ) && ( CmpItems( GetItemText(lo, nCol) , midItem, nCol) > 0 ) )
   			++lo;

 		// find an element that is smaller than or equal to// the partition element starting from the right Index.if( bAscending )
  			//while( ( hi > low ) && (atoi(GetItemText(hi, nCol)) > midItem ) )
			/*!!!*  while( ( hi > low ) && ( CmpItems(GetItemText(hi, nCol) , midItem, nCol ) > 0 ) )
   				--hi;
 		else//while( ( hi > low ) && (atoi(GetItemText(hi, nCol)) < midItem ) )
			/*!!!*  while( ( hi > low ) && ( CmpItems(GetItemText(hi, nCol) , midItem, nCol ) < 0 ) )
   			--hi;

 		// if the indexes have not crossed, swap// and if the items are not equalif( lo <= hi )
 		{
			// swap only if the items are not equal//if(atoi(GetItemText(lo, nCol)) != atoi(GetItemText(hi, nCol)) )
			/*!!!*  if( CmpItems (GetItemText(lo, nCol) , GetItemText(hi, nCol), Col  ) != 0) {
	   			// swap the rows
	   			LV_ITEM lvitemlo, lvitemhi;

	   			int nColCount = ((CHeaderCtrl*)GetDlgItem(0))->GetItemCount();
	   			rowText.SetSize( nColCount );

	   			int i;
	   			for( i=0; i < nColCount; i++)
	      			rowText[i] = GetItemText(lo, i);

	   			lvitemlo.mask = LVIF_IMAGE | LVIF_PARAM | LVIF_STATE;
	   			lvitemlo.iItem = lo;
	   			lvitemlo.iSubItem = 0;
	   			lvitemlo.stateMask = LVIS_CUT | LVIS_DROPHILITED |
	      					LVIS_FOCUSED |  LVIS_SELECTED |
	      					LVIS_OVERLAYMASK | LVIS_STATEIMAGEMASK;
	   			lvitemhi = lvitemlo;
	   			lvitemhi.iItem = hi;

	   			GetItem( &lvitemlo );
	   			GetItem( &lvitemhi );

	   			for( i=0; i< nColCount; i++)
	      			SetItemText(lo, i, GetItemText(hi, i) );

	   			lvitemhi.iItem = lo;
	   			SetItem( &lvitemhi );

	   			for( i=0; i< nColCount; i++)
	      			SetItemText(hi, i, rowText[i]);

	   			lvitemlo.iItem = hi;
	   			SetItem( &lvitemlo );
	  		}

	  		++lo;
	  		--hi;
	 	}
	}

	// If the right index has not reached the left side of array// must now sort the left partition.if( low < hi )
 		SortNumericItems( nCol, bAscending , low, hi);

	// If the left index has not reached the right side of array// must now sort the right partition.if( lo < high )
 		SortNumericItems( nCol, bAscending , lo, high );

	return TRUE;
}








//////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////// int i = 0;
CString str;
str.Format("%d",i*10);
// 序號for(i=0;i<10;i++)
?{? ??
??????str.Format("%d",i*10);
?? m_mm_host_ListCtrl.InsertItem(i, str, 0);
??????m_mm_host_ListCtrl.SetItemText(i, 1, str);??????m_mm_host_ListCtrl.SetItemText(i, 2, str);??????m_mm_host_ListCtrl.SetItemText(i, 3, str);}
/////////////////////////////////

void CMmDlg::OnDelete()
{
?int i,iState;

?int nItemSelected=m_mm_host_ListCtrl.GetSelectedCount();//所選表項數 
?int nItemCount=m_mm_host_ListCtrl.GetItemCount();//表項總數 
?if(nItemSelected<1)
??return;
?for(i=nItemCount-1;i>=0;i--)
?{
??iState=m_mm_host_ListCtrl.GetItemState(i,LVIS_SELECTED); 
??if(iState!=0) 
???m_mm_host_ListCtrl.DeleteItem(i);
?}
}
////////////////////////////////////////////////////////////////
CListCtrl使用技巧[轉]








/////////////////////////////////////////////////////////////////
?

1. CListCtrl 風格

????? LVS_ICON: 為每個item顯示大圖標
????? LVS_SMALLICON: 為每個item顯示小圖標
????? LVS_LIST: 顯示一列帶有小圖標的item
????? LVS_REPORT: 顯示item詳細資料
????? 直觀的理解:windows資源管理器,“查看”標簽下的“大圖標,小圖標,列表,詳細資料”
				
?

2. 設置listctrl 風格及擴展風格

????? LONG lStyle;
????? lStyle = GetWindowLong(m_list.m_hWnd, GWL_STYLE);//獲取當前窗口style
????? lStyle &= ~LVS_TYPEMASK; //清除顯示方式位
????? lStyle |= LVS_REPORT; //設置style
????? SetWindowLong(m_list.m_hWnd, GWL_STYLE, lStyle);//設置style
?
????? DWORD dwStyle = m_list.GetExtendedStyle();
????? dwStyle |= LVS_EX_FULLROWSELECT;//選中某行使整行高亮(只適用與report風格的listctrl)
????? dwStyle |= LVS_EX_GRIDLINES;//網格線(只適用與report風格的listctrl)
????? dwStyle |= LVS_EX_CHECKBOXES;//item前生成checkbox控件
????? m_list.SetExtendedStyle(dwStyle); //設置擴展風格
?
????? 注:listview的style請查閱msdn
????? http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceshellui5/html/wce50lrflistviewstyles.asp
				
				?

3. 插入數據

				
				
				
				????? m_list.InsertColumn( 0, "ID", LVCFMT_LEFT, 40 );//插入列
????? m_list.InsertColumn( 1, "NAME", LVCFMT_LEFT, 50 );
????? int nRow = m_list.InsertItem(0, “11”);//插入行
????? m_list.SetItemText(nRow, 1, “jacky”);//設置數據
?

4. 一直選中item

				??? 選中style中的Show selection always,或者在上面第2點中設置LVS_SHOWSELALWAYS


5. 選中和取消選中一行

??? int nIndex = 0;
??? //選中
??? m_list.SetItemState(nIndex, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
??? //取消選中
??? m_list.SetItemState(nIndex, 0, LVIS_SELECTED|LVIS_FOCUSED);
?

6. 得到listctrl中所有行的checkbox的狀態

????? m_list.SetExtendedStyle(LVS_EX_CHECKBOXES);
????? CString str;
????? for(int i=0; i????? {
?????????? if( m_list.GetItemState(i, LVIS_SELECTED) == LVIS_SELECTED || m_list.GetCheck(i))
?????????? {
??????????????? str.Format(_T("第%d行的checkbox為選中狀態"), i);
??????????????? AfxMessageBox(str);
?????????? }
????? }
				
?

7. 得到listctrl中所有選中行的序號

				
						
????? 方法一:
????? CString str;
????? for(int i=0; i????? {
?????????? if( m_list.GetItemState(i, LVIS_SELECTED) == LVIS_SELECTED )
?????????? {
??????????????? str.Format(_T("選中了第%d行"), i);
??????????????? AfxMessageBox(str);
?????????? }
????? }
????? 方法二:
????? POSITION pos = m_list.GetFirstSelectedItemPosition();
????? if (pos == NULL)
?????????? TRACE0("No items were selected!\n");
????? else
????? {
?????????? while (pos)
?????????? {
??????????????? int nItem = m_list.GetNextSelectedItem(pos);
??????????????? TRACE1("Item %d was selected!\n", nItem);
??????????????? // you could do your own processing on nItem here
?????????? }
????? }
				
?

8. 得到item的信息

????? TCHAR szBuf[1024];
????? LVITEM lvi;
????? lvi.iItem = nItemIndex;
????? lvi.iSubItem = 0;
????? lvi.mask = LVIF_TEXT;
????? lvi.pszText = szBuf;
????? lvi.cchTextMax = 1024;
????? m_list.GetItem(&lvi);
????? 關于得到設置item的狀態,還可以參考msdn文章
????? Q173242: Use Masks to Set/Get Item States in CListCtrl
?????????????? http://support.microsoft.com/kb/173242/en-us
				
						
?

9. 得到listctrl的所有列的header字符串內容

????? LVCOLUMN lvcol;
????? char? str[256];
????? int?? nColNum;
????? CString? strColumnName[4];//假如有4列
????? nColNum = 0;
????? lvcol.mask = LVCF_TEXT;
????? lvcol.pszText = str;
????? lvcol.cchTextMax = 256;
????? while(m_list.GetColumn(nColNum, &lvcol))
????? {
?????????? strColumnName[nColNum] = lvcol.pszText;
?????????? nColNum++;
????? }
				
?

10. 使listctrl中一項可見,即滾動滾動條

??? m_list.EnsureVisible(i, FALSE);

11. 得到listctrl列數

??? int nHeadNum = m_list.GetHeaderCtrl()->GetItemCount();

12. 刪除所有列

??? ? 方法一:
???? ??? while ( m_list.DeleteColumn (0))
??? ?? 因為你刪除了第一列后,后面的列會依次向上移動。
??? ? 方法二:
????? int nColumns = 4;
????? for (int i=nColumns-1; i>=0; i--)
????? ??? m_list.DeleteColumn (i);
				
?

13. 得到單擊的listctrl的行列號

????? 添加listctrl控件的NM_CLICK消息相應函數
????? void CTest6Dlg::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult)
????? {
?????????? // 方法一:
?????????? /*
?????????? DWORD dwPos = GetMessagePos();
?????????? CPoint point( LOWORD(dwPos), HIWORD(dwPos) );
??
?????????? m_list.ScreenToClient(&point);
??
?????????? LVHITTESTINFO lvinfo;
?????????? lvinfo.pt = point;
?????????? lvinfo.flags = LVHT_ABOVE;
????
?????????? int nItem = m_list.SubItemHitTest(&lvinfo);
?????????? if(nItem != -1)
?????????? {
??????????????? CString strtemp;
??????????????? strtemp.Format("單擊的是第%d行第%d列", lvinfo.iItem, lvinfo.iSubItem);
??????????????? AfxMessageBox(strtemp);
?????????? }
????????? */
??
????????? // 方法二:
????????? /*
?????????? NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
?????????? if(pNMListView->iItem != -1)
?????????? {
??????????????? CString strtemp;
??????????????? strtemp.Format("單擊的是第%d行第%d列",
??????????????????????????????? pNMListView->iItem, pNMListView->iSubItem);
??????????????? AfxMessageBox(strtemp);
?????????? }
????????? */
?????????? *pResult = 0;
????? }
?

14. 判斷是否點擊在listctrl的checkbox上

????? 添加listctrl控件的NM_CLICK消息相應函數
????? void CTest6Dlg::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult)
????? {
?????????? DWORD dwPos = GetMessagePos();
?????????? CPoint point( LOWORD(dwPos), HIWORD(dwPos) );
??
?????????? m_list.ScreenToClient(&point);
??
?????????? LVHITTESTINFO lvinfo;
?????????? lvinfo.pt = point;
?????????? lvinfo.flags = LVHT_ABOVE;
????
?????????? UINT nFlag;
?????????? int nItem = m_list.HitTest(point, &nFlag);
?????????? //判斷是否點在checkbox上
?????????? if(nFlag == LVHT_ONITEMSTATEICON)
?????????? {
??????????????? AfxMessageBox("點在listctrl的checkbox上");
?????????? }
?????????? *pResult = 0;
????? }
				
?

15. 右鍵點擊listctrl的item彈出菜單

????? 添加listctrl控件的NM_RCLICK消息相應函數
????? void CTest6Dlg::OnRclickList1(NMHDR* pNMHDR, LRESULT* pResult)
????? {
?????????? NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
?????????? if(pNMListView->iItem != -1)
?????????? {
??????????????? DWORD dwPos = GetMessagePos();
??????????????? CPoint point( LOWORD(dwPos), HIWORD(dwPos) );
???
??????????????? CMenu menu;
??????????????? VERIFY( menu.LoadMenu( IDR_MENU1 ) );
??????????????? CMenu* popup = menu.GetSubMenu(0);
??????????????? ASSERT( popup != NULL );
??????????????? popup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this );
?????????? }
?????????? *pResult = 0;
? }
				
?
?

16. item切換焦點時(包括用鍵盤和鼠標切換item時),狀態的一些變化順序

????? 添加listctrl控件的LVN_ITEMCHANGED消息相應函數
????? void CTest6Dlg::OnItemchangedList1(NMHDR* pNMHDR, LRESULT* pResult)
????? {
?????????? NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
?????????? // TODO: Add your control notification handler code here
???
?????????? CString sTemp;
?
?????????? if((pNMListView->uOldState & LVIS_FOCUSED) == LVIS_FOCUSED &&
??????????? (pNMListView->uNewState & LVIS_FOCUSED) == 0)
?????????? {
??????????????? sTemp.Format("%d losted focus",pNMListView->iItem);
?????????? }
?????????? else if((pNMListView->uOldState & LVIS_FOCUSED) == 0 &&
?????????????? (pNMListView->uNewState & LVIS_FOCUSED) == LVIS_FOCUSED)
?????????? {
??????????????? sTemp.Format("%d got focus",pNMListView->iItem);
?????????? }
?
?????????? if((pNMListView->uOldState & LVIS_SELECTED) == LVIS_SELECTED &&
??????????? (pNMListView->uNewState & LVIS_SELECTED) == 0)
?????????? {
??????????????? sTemp.Format("%d losted selected",pNMListView->iItem);
?????????? }
?????????? else if((pNMListView->uOldState & LVIS_SELECTED) == 0 &&
??????????? (pNMListView->uNewState & LVIS_SELECTED) == LVIS_SELECTED)
?????????? {
??????????????? sTemp.Format("%d got selected",pNMListView->iItem);
?????????? }
???
?????????? *pResult = 0;
????? }
				

?

17. 得到另一個進程里的listctrl控件的item內容

				
				
				
						http://www.codeproject.com/threads/int64_memsteal.asp
				
				


18. 選中listview中的item

Q131284: How To Select a Listview Item Programmatically
http://support.microsoft.com/kb/131284/en-us


19. 如何在CListView中使用CListCtrl的派生類

				
						http://www.codeguru.com/cpp/controls/listview/introduction/article.php/c919/
				
				
				
						
?

20. listctrl的subitem添加圖標

????? m_list.SetExtendedStyle(LVS_EX_SUBITEMIMAGES);
????? m_list.SetItem(..); //具體參數請參考msdn
?

21. 在CListCtrl顯示文件,并根據文件類型來顯示圖標

????? 網上找到的代碼,share
????? BOOL CTest6Dlg::OnInitDialog()
????? {
?????????? CDialog::OnInitDialog();
??
?????????? HIMAGELIST himlSmall;
?????????? HIMAGELIST himlLarge;
?????????? SHFILEINFO sfi;
?????????? char? cSysDir[MAX_PATH];
?????????? CString? strBuf;
?
?????????? memset(cSysDir, 0, MAX_PATH);
??
?????????? GetWindowsDirectory(cSysDir, MAX_PATH);
?????????? strBuf = cSysDir;
?????????? sprintf(cSysDir, "%s", strBuf.Left(strBuf.Find("\\")+1));
?
?????????? himlSmall = (HIMAGELIST)SHGetFileInfo ((LPCSTR)cSysDir,?
????????????????????? 0,?
????????????????????? &sfi,
????????????????????? sizeof(SHFILEINFO),?
????????????????????? SHGFI_SYSICONINDEX | SHGFI_SMALLICON );
??
?????????? himlLarge = (HIMAGELIST)SHGetFileInfo((LPCSTR)cSysDir,?
????????????????????? 0,?
????????????????????? &sfi,?
????????????????????? sizeof(SHFILEINFO),?
????????????????????? SHGFI_SYSICONINDEX | SHGFI_LARGEICON);
??
?????????? if (himlSmall && himlLarge)
?????????? {
??????????????? ::SendMessage(m_list.m_hWnd, LVM_SETIMAGELIST,
???????????????????????????? (WPARAM)LVSIL_SMALL, (LPARAM)himlSmall);
??????????????? ::SendMessage(m_list.m_hWnd, LVM_SETIMAGELIST,
???????????????????????????? (WPARAM)LVSIL_NORMAL, (LPARAM)himlLarge);
?????????? }
?????????? return TRUE;? // return TRUE? unless you set the focus to a control
????? }
?
????? void CTest6Dlg::AddFiles(LPCTSTR lpszFileName, BOOL bAddToDocument)
????? {
?????????? int nIcon = GetIconIndex(lpszFileName, FALSE, FALSE);
?????????? CString strSize;
?????????? CFileFind filefind;
?
?????????? //? get file size
?????????? if (filefind.FindFile(lpszFileName))
?????????? {
??????????????? filefind.FindNextFile();
??????????????? strSize.Format("%d", filefind.GetLength());
?????????? }
?????????? else
??????????????? strSize = "0";
??
?????????? // split path and filename
?????????? CString strFileName = lpszFileName;
?????????? CString strPath;
?
?????????? int nPos = strFileName.ReverseFind('\\');
?????????? if (nPos != -1)
?????????? {
??????????????? strPath = strFileName.Left(nPos);
??????????????? strFileName = strFileName.Mid(nPos + 1);
?????????? }
??
?????????? // insert to list
?????????? int nItem = m_list.GetItemCount();
?????????? m_list.InsertItem(nItem, strFileName, nIcon);
?????????? m_list.SetItemText(nItem, 1, strSize);
?????????? m_list.SetItemText(nItem, 2, strFileName.Right(3));
?????????? m_list.SetItemText(nItem, 3, strPath);
????? }
?
????? int CTest6Dlg::GetIconIndex(LPCTSTR lpszPath, BOOL bIsDir, BOOL bSelected)
????? {
?????????? SHFILEINFO sfi;
?????????? memset(&sfi, 0, sizeof(sfi));
??
?????????? if (bIsDir)
?????????? {
??????????? SHGetFileInfo(lpszPath,?
???????????????????????? FILE_ATTRIBUTE_DIRECTORY,?
???????????????????????? &sfi,?
???????????????????????? sizeof(sfi),?
???????????????????????? SHGFI_SMALLICON | SHGFI_SYSICONINDEX |
???????????????????????? SHGFI_USEFILEATTRIBUTES |(bSelected ? SHGFI_OPENICON : 0));?
??????????? return? sfi.iIcon;
?????????? }
?????????? else
?????????? {
??????????? SHGetFileInfo (lpszPath,?
???????????????????????? FILE_ATTRIBUTE_NORMAL,?
???????????????????????? &sfi,?
???????????????????????? sizeof(sfi),?
???????????????????????? SHGFI_SMALLICON | SHGFI_SYSICONINDEX |?
???????????????????????? SHGFI_USEFILEATTRIBUTES | (bSelected ? SHGFI_OPENICON : 0));
??????????? return?? sfi.iIcon;
?????????? }
?????????? return? -1;
????? }
				
?

22. listctrl內容進行大數據量更新時,避免閃爍

????? m_list.SetRedraw(FALSE);
????? //更新內容
????? m_list.SetRedraw(TRUE);
????? m_list.Invalidate();
????? m_list.UpdateWindow();
?
或者參考
				
						http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_cwnd.3a3a.setredraw.asp
				
				
				
						
?

23. listctrl排序

Q250614:How To Sort Items in a CListCtrl in Report View
http://support.microsoft.com/kb/250614/en-us
				
						
?

24. 在listctrl中選中某個item時動態改變其icon或bitmap

Q141834: How to change the icon or the bitmap of a CListCtrl item in Visual C++
http://support.microsoft.com/kb/141834/en-us


25. 在添加item后,再InsertColumn()后導致整列數據移動的問題

Q151897: CListCtrl::InsertColumn() Causes Column Data to Shift 
http://support.microsoft.com/kb/151897/en-us
				
						
?

26. 關于listctrl第一列始終居左的問題

解決辦法:把第一列當一個虛列,從第二列開始插入列及數據,最后刪除第一列。
?????
具體解釋參閱?? http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/listview/structures/lvcolumn.asp
				
				?

27. 鎖定column header的拖動

				
						http://msdn.microsoft.com/msdnmag/issues/03/06/CQA/
				
				
				
						
?

28. 如何隱藏clistctrl的列

??? 把需隱藏的列的寬度設為0,然后檢測當該列為隱藏列時,用上面第27點的鎖定column 的拖動來實現

29. listctrl進行大數據量操作時,使用virtual list???

				
						http://www.codeguru.com/cpp/controls/listview/advanced/article.php/c4151/
				
				
http://www.codeproject.com/listctrl/virtuallist.asp
				
						
?

30. 關于item只能顯示259個字符的問題

解決辦法:需要在item上放一個edit。
				
?

31. 響應在listctrl的column header上的鼠標右鍵單擊

Q125694: How To Find Out Which Listview Column Was Right-Clicked
http://support.microsoft.com/kb/125694/en-us
				
						
?

32. 類似于windows資源管理器的listview

Q234310: How to implement a ListView control that is similar to Windows Explorer by using DirLV.exe
http://support.microsoft.com/kb/234310/en-us
				
				?

33. 在ListCtrl中OnTimer只響應兩次的問題

Q200054:
PRB: OnTimer() Is Not Called Repeatedly for a List Control
http://support.microsoft.com/kb/200054/en-us

34. 以下為一些為實現各種自定義功能的listctrl派生類

????????? (1)??? 拖放??????? 
?????????????????? http://www.codeproject.com/listctrl/dragtest.asp
?????????????????? 在CListCtrl和CTreeCtrl間拖放
?????????????????? http://support.microsoft.com/kb/148738/en-us
?
????????? (2)??? 多功能listctrl
?????????????????? 支持subitem可編輯,圖標,radiobutton,checkbox,字符串改變顏色的類
?????????????????? http://www.codeproject.com/listctrl/quicklist.asp
?
?????????????????? 支持排序,subitem可編輯,subitem圖標,subitem改變顏色的類
?????????????????? http://www.codeproject.com/listctrl/ReportControl.asp
????????? (3)??? subitem中顯示超鏈接
?????????????????? http://www.codeproject.com/listctrl/CListCtrlLink.asp
????????? (4)??? subitem的tooltip提示
?????????????????? http://www.codeproject.com/listctrl/ctooltiplistctrl.asp
????????? (5)??? subitem中顯示進度條??? 
?????????????????? http://www.codeproject.com/listctrl/ProgressListControl.asp
?????????????????? http://www.codeproject.com/listctrl/napster.asp
?????????????????? http://www.codeguru.com/Cpp/controls/listview/article.php/c4187/
????????? (6)??? 動態改變subitem的顏色和背景色
??????????????????? http://www.codeproject.com/listctrl/highlightlistctrl.asp
??? ??? ??? ??? ??? http://www.codeguru.com/Cpp/controls/listbox/colorlistboxes/article.php/c4757/
?
????????? (7)??? 類vb屬性對話框
??????????????????? http://www.codeproject.com/listctrl/propertylistctrl.asp
??????????????????? http://www.codeguru.com/Cpp/controls/listview/propertylists/article.php/c995/
??????????????????? http://www.codeguru.com/Cpp/controls/listview/propertylists/article.php/c1041/
?
????????? (8)??? 選中subitem(只高亮選中的item)
??????????????????? http://www.codeproject.com/listctrl/SubItemSel.asp
??????????????????? http://www.codeproject.com/listctrl/ListSubItSel.asp
?
????????? (9)??? 改變行高
??????????????????? http://www.codeproject.com/listctrl/changerowheight.asp
?
????????? (10)?? 改變行顏色
??????????????????? http://www.codeproject.com/listctrl/coloredlistctrl.asp
?
????????? (11)?? 可編輯subitem的listctrl
??????????????????? http://www.codeproject.com/listctrl/nirs2000.asp
??????????????????? http://www.codeproject.com/listctrl/editing_subitems_in_listcontrol.asp
?
????????? (12)?? subitem可編輯,插入combobox,改變行顏色,subitem的tooltip提示
??????????????????? http://www.codeproject.com/listctrl/reusablelistcontrol.asp
?
????????? (13)?? header 中允許多行字符串
??????????????????? http://www.codeproject.com/listctrl/headerctrlex.asp
?
????????? (14)?? 插入combobox
??????????????????? http://www.codeguru.com/Cpp/controls/listview/editingitemsandsubitem/article.php/c979/
?
????????? (15)?? 添加背景圖片
??????????????????? http://www.codeguru.com/Cpp/controls/listview/backgroundcolorandimage/article.php/c4173/
??????????????????? http://www.codeguru.com/Cpp/controls/listview/backgroundcolorandimage/article.php/c983/
??????????????????? http://www.vchelp.net/vchelp/archive.asp?type_id=9&class_id=1&cata_id=1&article_id=1088&search_term=
???
????????? (16)? 自適應寬度的listctrl
??????????????????? http://www.codeproject.com/useritems/AutosizeListCtrl.asp
??? ?? ?? (17)? 改變ListCtrl高亮時的顏色(默認為藍色)
??? ?? ?? ?? ?? ?? 處理 NM_CUSTOMDRAW
??????????
http://www.codeproject.com/listctrl/lvcustomdraw.asp

				
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////






m_mm_host_ListCtrl.DeleteAllItems()


m_mm_host_ListCtrl.ModifyStyle(0,LVS_REPORT);
?////////////
?LONG lStyle = m_mm_host_ListCtrl.SendMessage(
????????LVM_GETEXTENDEDLISTVIEWSTYLE);
?lStyle |= LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES |
????LVS_EX_HEADERDRAGDROP;
?m_mm_host_ListCtrl.SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0,
???(LPARAM)lStyle);






?////////////

?或者:
LONG lStyle;
?lStyle = GetWindowLong(m_mm_host_ListCtrl.m_hWnd, GWL_STYLE);//獲取當前窗口style
?lStyle &= ~LVS_TYPEMASK; //清除顯示方式位
?lStyle |= LVS_REPORT; //設置style
?SetWindowLong(m_mm_host_ListCtrl.m_hWnd, GWL_STYLE, lStyle);//設置style
?
?DWORD dwStyle = m_mm_host_ListCtrl.GetExtendedStyle();
?dwStyle |= LVS_EX_FULLROWSELECT;//選中某行使整行高亮(只適用與report風格的listctrl)
?dwStyle |= LVS_EX_GRIDLINES;//網格線(只適用與report風格的listctrl)
?dwStyle |= LVS_EX_CHECKBOXES;//item前生成checkbox控件
?m_mm_host_ListCtrl.SetExtendedStyle(dwStyle); //設置擴展風格






?/////////////












m_mm_host_ListCtrl.InsertColumn(0,"日志序號",LVCFMT_CENTER,60,0);
?m_mm_host_ListCtrl.InsertColumn(1,"來源",LVCFMT_CENTER,80,1);
?m_mm_host_ListCtrl.InsertColumn(2,"日期",LVCFMT_CENTER,80,2);
?m_mm_host_ListCtrl.InsertColumn(3,"時間",LVCFMT_CENTER,80,3);
?m_mm_host_ListCtrl.InsertColumn(4,"分類",LVCFMT_CENTER,80,4);
?m_mm_host_ListCtrl.InsertColumn(5,"ID",LVCFMT_CENTER,50,5);
?m_mm_host_ListCtrl.InsertColumn(6,"用戶",LVCFMT_CENTER,120,6);
?m_mm_host_ListCtrl.InsertColumn(7,"計算機",LVCFMT_CENTER,120,7);


/////////////////////////////////////////////////////////////////////////
				
?

posted on 2006-08-30 13:31 啤酒 閱讀(1355) 評論(0)  編輯 收藏 引用


只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


導航

統計

常用鏈接

留言簿(2)

隨筆檔案

收藏夾

搜索

最新評論

閱讀排行榜

評論排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            久久久亚洲影院你懂的| 亚洲欧美成人在线| 影音先锋久久| 99精品视频网| 亚洲在线观看免费视频| 久久精品国产99| 欧美激情亚洲国产| 日韩一区二区精品| 欧美一区二区在线播放| 欧美伦理视频网站| 国产女人水真多18毛片18精品视频| 欧美精品首页| 黑人一区二区| 亚洲综合另类| 小黄鸭精品aⅴ导航网站入口| 美腿丝袜亚洲色图| 国产精品视频久久久| 亚洲国产精品va在看黑人| 中文日韩电影网站| 欧美不卡视频一区| 亚洲婷婷综合色高清在线| 久久综合九色欧美综合狠狠| 国产精品一区免费观看| 亚洲精品国精品久久99热一| 欧美怡红院视频| 亚洲精品一区二区在线| 欧美成人综合网站| 韩日精品视频一区| 亚洲人午夜精品| 亚洲欧美成aⅴ人在线观看| 午夜精品www| 欧美视频在线播放| 91久久久国产精品| 欧美a级一区二区| 国产精品hd| 99re热这里只有精品视频| 亚洲制服丝袜在线| 国产精品美女999| 欧美有码在线观看视频| 蜜臀久久99精品久久久画质超高清| 一区二区三区日韩精品| 日韩亚洲国产精品| 一色屋精品亚洲香蕉网站| 一区二区三区免费在线观看| 欧美日韩一区二区在线| 国产精品99久久久久久久久久久久| 欧美在线免费视屏| 在线观看成人一级片| 亚洲午夜羞羞片| 一个人看的www久久| 一本色道久久综合亚洲91| 在线播放日韩| 久久国产精品毛片| 亚洲精品免费网站| 久久人人爽爽爽人久久久| 亚洲国产成人久久综合| 欧美一级电影久久| 欧美一区二区三区视频在线观看| 欧美经典一区二区| 亚洲国产mv| 欧美性天天影院| 亚洲精品影视在线观看| 亚洲精品亚洲人成人网| 免费一区视频| 午夜精品一区二区在线观看| 欧美一区三区三区高中清蜜桃| 中文在线一区| 欧美午夜寂寞影院| 这里只有精品视频在线| 狠狠色狠狠色综合| 久久精品国产免费| 免费观看一级特黄欧美大片| 欧美理论在线| 日韩视频免费在线观看| 亚洲午夜电影网| 久久久伊人欧美| 欧美电影打屁股sp| 国产精品羞羞答答| 欧美一区二区久久久| 久久精品官网| 亚洲福利av| 欧美激情一区在线| 一区二区三区高清视频在线观看 | 一区二区三区久久网| 亚洲视频 欧洲视频| 国产精品第十页| 欧美电影资源| 一本一本久久| 国产欧美日本| 久热爱精品视频线路一| 亚洲精品一区二区三区99| 亚洲在线视频| 在线观看日韩专区| 欧美久久久久免费| 午夜欧美大尺度福利影院在线看 | 亚洲在线国产日韩欧美| 国产视频亚洲| 日韩一级在线| 久久久青草婷婷精品综合日韩| 欧美激情一区二区在线| 一区二区三区视频在线看| 久久精品亚洲乱码伦伦中文 | 欧美视频在线播放| 亚洲欧美日韩在线高清直播| 蜜桃av综合| 亚洲综合成人婷婷小说| 在线观看视频亚洲| 国产精品magnet| 鲁鲁狠狠狠7777一区二区| 亚洲婷婷综合色高清在线| 免费不卡视频| 午夜电影亚洲| 一本到12不卡视频在线dvd| 国产女人水真多18毛片18精品视频| 久久在线观看视频| 亚洲欧美国产视频| 亚洲精品乱码久久久久久按摩观 | 亚洲欧美日本国产有色| 在线观看欧美视频| 国产精品无码永久免费888| 免费在线播放第一区高清av| 亚洲在线观看免费视频| 午夜视频在线观看一区二区三区 | 国产精品免费网站在线观看| 久久在线视频| 欧美一级日韩一级| 亚洲一本视频| 一本久道久久综合婷婷鲸鱼| 一区二区精品| 亚洲乱码国产乱码精品精| 欧美国产日韩精品| 日韩一级免费| 亚洲精品在线二区| 亚洲福利视频三区| 欧美高清在线视频| 麻豆国产精品一区二区三区 | 国内精品久久久久伊人av| 香蕉久久a毛片| 亚洲少妇最新在线视频| 亚洲精品国产欧美| 亚洲黄色精品| 欧美一区2区视频在线观看 | 亚洲国产高清在线观看视频| 国产在线不卡视频| 国产情人节一区| 国产欧美视频一区二区三区| 国产精品色婷婷久久58| 国产精品免费福利| 国产精品嫩草影院av蜜臀| 欧美亚一区二区| 国产精品福利在线| 国产精品久久久久久影视 | 国产精品亚洲综合久久| 欧美性猛片xxxx免费看久爱| 国产精品播放| 国产精品自拍三区| 国产亚洲精品一区二区| 欧美成人免费在线观看| 欧美国产日本韩| 欧美日韩一区二区在线观看| 欧美日韩国产免费| 欧美在线播放一区| 久久久久国产精品厨房| 欧美成人69av| 欧美午夜一区二区福利视频| 国产精品五月天| 黄色日韩网站视频| 亚洲国产一二三| 韩国av一区| 亚洲美女av黄| 亚洲婷婷免费| 久久久亚洲精品一区二区三区| 久热精品视频在线观看| 欧美激情视频网站| 亚洲视频一二| 久久色在线观看| 欧美色综合网| 伊人久久噜噜噜躁狠狠躁| 日韩视频一区二区三区| 久久av一区二区| 亚欧成人在线| 亚洲欧美日韩精品久久奇米色影视 | 欧美~级网站不卡| 国产精品爱啪在线线免费观看| 国产一区二区三区在线观看免费| 亚洲高清资源| 欧美主播一区二区三区| 亚洲国产91| 久久精品成人| 国产精品白丝av嫩草影院| 亚洲国产精品一区在线观看不卡| 亚洲永久免费观看| 欧美~级网站不卡| 亚洲在线国产日韩欧美| 久久综合伊人77777| 国产精品人成在线观看免费| 亚洲人成在线观看网站高清| 欧美在线免费观看| 亚洲精品免费观看| 蜜桃伊人久久|