//设置列信息 bool CUserListView::SetColumnDescribe(tagColumnItem ColumnItem[], WORD wColumnCount) { //效验状态 ASSERT(ColumnItem!=NULL); if (GetSafeHwnd()==NULL) return false; //删除旧信息 m_wColumnCount=0; WORD wTempCount=m_SkinHeadCtrl.GetItemCount(); for (WORD i=0;i<wTempCount;i++) DeleteColumn(0); //调整参数 wColumnCount=__min(MAX_COLUMN-1,wColumnCount); //插入新信息 SetRedraw(FALSE); for (WORD i=0;i<wColumnCount;i++) { m_wDataDescribe[i]=ColumnItem[i].wDataDescribe; if (m_wColumnCount==0) InsertColumn(m_wColumnCount++,ColumnItem[i].szColumnName,LVCFMT_LEFT,ColumnItem[i].wColumnWidth+m_uImageSpace); else InsertColumn(m_wColumnCount++,ColumnItem[i].szColumnName,LVCFMT_LEFT,ColumnItem[i].wColumnWidth); } SetRedraw(TRUE); return true; }
void CMyListCtrl::DeleteAllColumns() { for (int i = GetHeaderCtrl()->GetItemCount(); i >= 0; i--) { DeleteColumn(i); } }
void CMyListCtrl::DeleteAllColumns() { for(int i=get_ColumnCount()-1;i>=0;i--) { DeleteColumn(i); } }
/*** 初始化策略报表ListCtrl成操作记录列表 */ BOOL CReportListCtrl::InitOpRecordList( ) { SendMessage( LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP | LVS_EX_FLATSB | LVS_EX_REGIONAL | LVS_EX_INFOTIP | LVS_EX_UNDERLINEHOT ); while( DeleteColumn(0) ); CString strTime, strOp, strStock, strShare, strSharePrice, strAmount, strRateCost; strTime.LoadString( IDS_SIMUREPORT_TIME ); strOp.LoadString( IDS_SIMUREPORT_OP ); strStock.LoadString( IDS_SIMUREPORT_STOCK ); strShare.LoadString( IDS_SIMUREPORT_SHARE ); strSharePrice.LoadString( IDS_SIMUREPORT_SHAREPRICE ); strAmount.LoadString( IDS_SIMUREPORT_AMOUNT ); strRateCost.LoadString( IDS_SIMUREPORT_RATECOST ); InsertColumn( 0, strTime, LVCFMT_CENTER, 70 ); InsertColumn( 1, strOp, LVCFMT_CENTER, 60 ); InsertColumn( 2, strStock, LVCFMT_CENTER, 70 ); InsertColumn( 3, strShare, LVCFMT_CENTER, 60 ); InsertColumn( 4, strSharePrice, LVCFMT_CENTER, 56 ); InsertColumn( 5, strAmount, LVCFMT_CENTER, 70 ); InsertColumn( 6, strRateCost, LVCFMT_CENTER, 60 ); return TRUE; }
void CGitProgressList::Init() { SetExtendedStyle (LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER); DeleteAllItems(); int c = ((CHeaderCtrl*)(GetDlgItem(0)))->GetItemCount()-1; while (c>=0) DeleteColumn(c--); CString temp; temp.LoadString(IDS_PROGRS_ACTION); InsertColumn(0, temp); temp.LoadString(IDS_PROGRS_PATH); InsertColumn(1, temp); m_pThread = AfxBeginThread(ProgressThreadEntry, this, THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED); if (m_pThread==NULL) { ReportError(CString(MAKEINTRESOURCE(IDS_ERR_THREADSTARTFAILED))); } else { m_pThread->m_bAutoDelete = FALSE; m_pThread->ResumeThread(); } // Call this early so that the column headings aren't hidden before any // text gets added. ResizeColumns(); SetTimer(VISIBLETIMER, 300, NULL); }
/* Utility function to get rid of all the columns */ void CMultiColumnSortListCtrl::DeleteAllColumns() { int iNumCols = GetColumnCount(); for ( int i = 0; i < iNumCols; i++ ) { DeleteColumn(0); } }
// Moves column. Target position includes both hidden // as well as shown columns void wxListCtrlEx::MoveColumn(unsigned int col, unsigned int before) { if (m_columnInfo[col].order == before) return; for (unsigned int i = 0; i < m_columnInfo.size(); i++) { if (i == col) continue; t_columnInfo& info = m_columnInfo[i]; if (info.order > col) info.order--; if (info.order >= before) info.order++; } t_columnInfo& info = m_columnInfo[col]; if (info.shown) { int icon = -1; // Remove old column for (unsigned int i = 0; i < (unsigned int)GetColumnCount(); i++) { if (m_pVisibleColumnMapping[i] != col) continue; for (unsigned int j = i + 1; j < (unsigned int)GetColumnCount(); j++) m_pVisibleColumnMapping[j - 1] = m_pVisibleColumnMapping[j]; info.width = GetColumnWidth(i); icon = GetHeaderSortIconIndex(i); DeleteColumn(i); break; } // Insert new column unsigned int pos = 0; for (unsigned int i = 0; i < m_columnInfo.size(); i++) { if (i == col) continue; t_columnInfo& info = m_columnInfo[i]; if (info.shown && info.order < before) pos++; } for (unsigned int i = (int)GetColumnCount(); i > pos; i--) m_pVisibleColumnMapping[i] = m_pVisibleColumnMapping[i - 1]; m_pVisibleColumnMapping[pos] = col; InsertColumn(pos, info.name, info.align, info.width); SetHeaderSortIconIndex(pos, icon); } m_columnInfo[col].order = before; }
BOOL CReportCtrl::DeleteAllColumns() { while(GetColumnCount() > 0) { DeleteColumn(0); } return(TRUE); }
void CListCtrlEx::DeleteHdrItem(int iItem) { int aOrder [LISTEX_MAXCOLUMNS]; GetColumnOrderArray ((int*) aOrder, GetHeaderCtrl ()->GetItemCount ()); int iCol = aOrder [m_aIndex [iItem]]; DeleteColumn (iCol); RebuildAIndex (); OnForceUpdate (); }
void CMyListCtrl::ClearHead(void) { int headCount = m_Head.GetItemCount(); for (int i=0;i<headCount;i++) { DeleteColumn(0); } m_Head.m_HeadCell.RemoveAll(); }
void CListCtrlEx::ReadState(LPCSTR pszName) { CHeaderCtrl* pHdr = GetHeaderCtrl (); int *piWidthes; Initialize (); LPBYTE pbW, pbI; UINT uSizeI, uSizeW; CString strIndexes = pszName, strWidthes = pszName; strIndexes += 'I'; strWidthes += 'W'; if (_App.GetProfileBinary (_T ("Settings\\View\\ListViews"), strIndexes, &pbI, &uSizeI) && _App.GetProfileBinary (_T ("Settings\\View\\ListViews"), strWidthes, &pbW, &uSizeW) && uSizeI == m_cTotalCols * sizeof (int) && uSizeW == m_cTotalCols * sizeof (int)) { CopyMemory (m_aIndex, pbI, m_cTotalCols * sizeof (int)); piWidthes = (int*) pbW; int i = m_cTotalCols - 1; for (i = m_cTotalCols - 1; i >= 0; i--) if (m_aIndex [i] == -1) DeleteColumn (i); int aOrder [LISTEX_MAXCOLUMNS]; int iCorr = 0; for (i = 0; i < m_cTotalCols; i++) { if (m_aIndex [i] != -1) aOrder [m_aIndex [i]] = i - iCorr; else iCorr ++; } pHdr->SetOrderArray (GetHeaderCtrl ()->GetItemCount (), (int*) aOrder); RebuildAIndex (); for (i = 0; i < m_cTotalCols; i++) { if (piWidthes [i] > 0) SetColumnWidth (aOrder [m_aIndex [i]], piWidthes [i]); } delete [] pbW; delete [] pbI; } }
void CDataWnd::CreateSurvey () { uvar32_64 n, len; for (n = 0, len = GetHeaderCtrl()->GetItemCount(); n < len; ++n) DeleteColumn (0); DeleteAllItems (); if (m_pDoc->Surveis(aimActive).GetCount () != 1) return; InsertColumn (0, "", LVCFMT_RIGHT, 20, 0); for (n = 0, len = m_pDoc->Surveis[aimActive].Fields.GetCount (); n < len; ++n) InsertColumn (n + 1, m_pDoc->Surveis[aimActive].Fields[n].GetName (), LVCFMT_LEFT, 80, n + 1); }
// ---------------------------------------------------------------------------- // ArchiveEntryList::setupColumns // // Creates/sets the list columns depending on user options // ---------------------------------------------------------------------------- void ArchiveEntryList::setupColumns() { // Remove existing columns while (GetColumnCount() > 0) DeleteColumn(0); // Create columns int col_num = 0; col_index = -1; col_name = 0; col_size = -1; col_type = -1; // Index if (elist_colindex_show) { AppendColumn("#"); SetColumnWidth(col_num, elist_colindex_width); col_index = col_num++; } // Name (always) AppendColumn("Name"); SetColumnWidth(col_num, elist_colname_width); col_name = col_num++; // Size if (elist_colsize_show) { AppendColumn("Size"); SetColumnWidth(col_num, elist_colsize_width); col_size = col_num++; } // Type if (elist_coltype_show) { AppendColumn("Type"); SetColumnWidth(col_num, elist_coltype_width); col_type = col_num++; } // Set editable setColumnEditable(col_name); // Name column // Reset sorting sort_column = -1; sort_descend = false; }
void DictionaryListCtrl::SetType(ListType t) { m_type = t; for (int i = GetColumnCount() - 1; i >= 0; --i) { DeleteColumn(i); } InsertColumn(0, _("Filename")); if (m_type == wxLOCAL) { InsertColumn(1, _("Size")); SetColumnWidths(60); } else { SetColumnWidths(0); } SetFont(wxFont(8, 76, 90, 90, false, wxEmptyString)); RefreshItems(0, GetItemCount()); }
void wxListCtrlEx::ShowColumn(unsigned int col, bool show) { if (col >= m_columnInfo.size()) return; if (m_columnInfo[col].shown == show) return; m_columnInfo[col].shown = show; if (show) { // Insert new column int pos = 0; for (unsigned int i = 0; i < m_columnInfo.size(); i++) { if (i == col) continue; t_columnInfo& info = m_columnInfo[i]; if (info.shown && info.order < m_columnInfo[col].order) pos++; } for (int i = GetColumnCount() - 1; i >= pos; i--) m_pVisibleColumnMapping[i + 1] = m_pVisibleColumnMapping[i]; m_pVisibleColumnMapping[pos] = col; t_columnInfo& info = m_columnInfo[col]; InsertColumn(pos, info.name, info.align, info.width); } else { int i; for (i = 0; i < GetColumnCount(); i++) { if (m_pVisibleColumnMapping[i] == col) break; } wxASSERT(m_columnInfo[col].order >= (unsigned int)i); for (int j = i + 1; j < GetColumnCount(); j++) m_pVisibleColumnMapping[j - 1] = m_pVisibleColumnMapping[j]; wxASSERT(i < GetColumnCount()); m_columnInfo[col].width = GetColumnWidth(i); DeleteColumn(i); } }
///////////////////////////////////////////////////////////////////////////// // CSortListCtrl message handlers int CSortListCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CListCtrl::OnCreate(lpCreateStruct) == -1) return -1; if(this->GetHeaderCtrl()==NULL) { InsertColumn(0, _T( " ")); DeleteColumn(0); } //设置列表窗口的子类 VERIFY( m_ctlHeader.SubclassWindow( this->GetHeaderCtrl()->GetSafeHwnd() ) ); return 0; }
/*** 初始化策略报表ListCtrl成拥有股票列表 */ BOOL CReportListCtrl::InitStockOwnList( ) { SendMessage( LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP | LVS_EX_FLATSB | LVS_EX_REGIONAL | LVS_EX_INFOTIP | LVS_EX_UNDERLINEHOT ); while( DeleteColumn(0) ); CString strStock, strShare, strBuyPrice, strNowPrice; strStock.LoadString( IDS_SIMUREPORT_STOCK ); strShare.LoadString( IDS_SIMUREPORT_OWNSHARE ); strBuyPrice.LoadString( IDS_SIMUREPORT_BUYPRICE ); strNowPrice.LoadString( IDS_SIMUREPORT_NOWPRICE ); InsertColumn( 0, strStock, LVCFMT_CENTER, 100 ); InsertColumn( 1, strShare, LVCFMT_CENTER, 100 ); InsertColumn( 2, strBuyPrice, LVCFMT_CENTER, 100 ); InsertColumn( 3, strNowPrice, LVCFMT_CENTER, 100 ); return TRUE; }
void CReportCtrl::InitControl(int Rows, int Style) { while (DeleteColumn(0)); // delete any existing columns for (int i = 0; i < m_Columns; i++) { InsertColumn(i, m_Column[i].Title, m_Column[i].Align, m_Column[i].Width, i); } #if _MFC_VER < 0x0700 // if MFC 6 if (Style & SORT_ARROWS) { // create header image list containing sort arrows m_HdrImgList.Create(IDB_HEADER_SORT, 8, 0, RGB(0, 128, 128)); GetHeaderCtrl()->SetImageList(&m_HdrImgList); } #endif m_Style = Style; ModifyStyle(0, LVS_REPORT); // force report view ResetControl(Rows); }
void CUnitPane::ReloadHdr(const char * szConfigSectionHdr) { eSelMode selmode = sel_by_no; long seldata = 0; int i, x; m_sConfigSectionHdr = szConfigSectionHdr; DeleteAllItems(); x = m_pLayout ? (m_pLayout->Count()+20) : 100; for (i=x; i>=0; i--) DeleteColumn(i); LoadUnitListHdr(); if (m_pCurLand && m_pCurLand->guiUnit) { seldata = m_pCurLand->guiUnit; selmode = sel_by_id; } SetData(selmode, seldata, TRUE); }
BOOL CReportCtrl::DeleteAllColumns() { while (GetColumnCount() > 0) DeleteColumn(0); return TRUE; }
void CListCtrlEx::DeleteAllColumns() { while (GetHeaderCtrl()->GetItemCount()) DeleteColumn(0); }
//删除所有列 void CMyCListCtrl::SMT_DeleteAllCol( ) { m_hWnd; while ( DeleteColumn (0)); }
// SetListColumnOrder() is called mostly from OnRestoreState(), so we don't // call OnSaveState() from here. CDlgHiddenColumns calls OnSaveState() // when we really need to do that. // // Unfortunately, we have no way of immediately calling OnSaveState() when // the user manually reorders columns because that does not generate a // notification from MS Windows so wxWidgets can't generate an event. void CBOINCListCtrl::SetListColumnOrder(wxArrayString& orderArray) { int i, stdCount, columnPosition; int colCount = GetColumnCount(); int shownColCount = orderArray.GetCount(); int columnIndex = 0; // Column number among shown columns before re-ordering int columnID = 0; // ID of column, e.g. COLUMN_PROJECT, COLUMN_STATUS, etc. int sortColumnIndex = -1; wxArrayInt aOrder(shownColCount); CBOINCBaseView* pView = (CBOINCBaseView*)GetParent(); wxASSERT(wxDynamicCast(pView, CBOINCBaseView)); pView->m_iColumnIndexToColumnID.Clear(); for (i=colCount-1; i>=0; --i) { DeleteColumn(i); } stdCount = pView->m_aStdColNameOrder->GetCount(); pView->m_iColumnIDToColumnIndex.Clear(); for (columnID=0; columnID<stdCount; ++columnID) { pView->m_iColumnIDToColumnIndex.Add(-1); } for (columnID=0; columnID<stdCount; ++columnID) { for (columnPosition=0; columnPosition<shownColCount; ++columnPosition) { if (orderArray[columnPosition].IsSameAs(pView->m_aStdColNameOrder->Item(columnID))) { aOrder[columnPosition] = columnIndex; pView->AppendColumn(columnID); pView->m_iColumnIndexToColumnID.Add(columnID); pView->m_iColumnIDToColumnIndex[columnID] = columnIndex; ++columnIndex; break; } } } // Prevent a crash bug if we just changed to a new locale. // // If a column has the same name in both the old and new locale, we guard against // changing the sort column to that column. // // CBOINCListCtrl::OnRestoreState() may have incorrectly added the column names in // the new locale as "new" columns, so check against both shownColCount and stdCount. int limit = wxMin(shownColCount, stdCount); if (columnIndex < limit) { SetStandardColumnOrder(); for (columnID=0; columnID<limit; ++columnID) { aOrder[columnID] = columnID; pView->AppendColumn(columnID); pView->m_iColumnIndexToColumnID.Add(columnID); pView->m_iColumnIDToColumnIndex[columnID] = columnID; } } // If sort column is now hidden, set the new first column as sort column if (pView->m_iSortColumnID >= 0) { sortColumnIndex = pView->m_iColumnIDToColumnIndex[pView->m_iSortColumnID]; if (sortColumnIndex < 0) { pView->m_iSortColumnID = pView->m_iColumnIndexToColumnID[0]; pView->m_bReverseSort = false; pView->SetSortColumn(0); } else { // Redraw the sort arrow, etc. pView->SetSortColumn(sortColumnIndex); } } #ifdef wxHAS_LISTCTRL_COLUMN_ORDER colCount = GetColumnCount(); if ((shownColCount > 0) && (shownColCount <= stdCount) && (colCount == shownColCount)) { SetColumnsOrder(aOrder); } #endif }
void CClyEditListCtrl::FillHeaderCtrl(CClyHostDoc *pDoc) { int i =0; int iStrLen = 0; HRESULT hr= S_OK; _variant_t str; CStringArray ColNameArray; BeginWaitCursor() ; try { _RecordsetPtr Rs ; CString strSQL; Rs.CreateInstance("ADODB.Recordset"); strSQL = _T("select * from 测硫仪实验数据"); if(Rs->State==adStateOpen) Rs->Close(); //IADORecordBindingPtr pIRB(pRsIED); hr = Rs->Open(strSQL.AllocSysString(), theApp.pConn.GetInterfacePtr(), adOpenStatic, adLockOptimistic, -1); TESTHR(hr); //得到所有字段名称 GetAllFieldName(Rs,&ColNameArray); SetRedraw(FALSE); //清除所有数据 DeleteAllItems(); //清除所有标题 do { DeleteColumn(0); } while(GetHeaderCtrl()->GetItemCount()>0); //写字段标题 for(i=ColNameArray.GetSize()-1;i>=0;i--) { CDC *pDC = GetDC(); iStrLen = pDC->GetTextExtent(ColNameArray.GetAt(i)).cx*1.5; InsertColumn(0,ColNameArray.GetAt(i),LVCFMT_CENTER,iStrLen ,-1); ReleaseDC(pDC); } /////////////////////////////////// /* LONG RecordCount = 0; RecordCount = Rs->GetRecordCount(); SetItemCount(RecordCount); if(RecordCount>0) { if(!Rs->adoEOF) Rs->MoveLast(); while(!Rs->BOF) { for(i=0;i<Rs->Fields->Count;i++) { str = Rs->GetCollect((_bstr_t)ColNameArray.GetAt(i)); if(i==0) InsertItem(0,VariantToStr(str)); else SetItemText(0,i,VariantToStr(str)); } Rs->MovePrevious(); } Rs->MoveFirst(); } */ ////////////////////////////////////// SetRedraw(TRUE); } catch(_com_error &e) { dump_com_error(e); } EndWaitCursor(); }