void CVariablesGrid::Init() { LuaState* state = theApp.GetDocument()->GetState(); m_buttonDatabase.SetGrid(this); m_imageList.Create(MAKEINTRESOURCE(IDB_FOLDERS), 16, 1, RGB(255,255,255)); SetImageList(&m_imageList); SetColumnCount(2); SetDefCellHeight(ROW_HEIGHT); SetRowCount(0); SetColumnWidth(NAME_COL, NAME_WIDTH); SetColumnWidth(DATA_COL, DATA_WIDTH); CString fontName = "Arial"; LOGFONT logFont; memset(&logFont, 0, sizeof(LOGFONT)); logFont.lfCharSet = DEFAULT_CHARSET; logFont.lfWeight = 700; logFont.lfHeight = 80; lstrcpyn(logFont.lfFaceName, fontName, fontName.GetLength()); m_titleFont.CreatePointFontIndirect(&logFont); m_dataFont.CreatePointFont(80, fontName); }
WBinaryPageList::WBinaryPageList(class WBinaryPage* parent, wxWindowID id) : wxListCtrl(parent, id, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_VIRTUAL | wxLC_SINGLE_SEL), binpage(*parent) { wxFont font(10, wxMODERN, wxNORMAL, wxNORMAL); SetFont(font); unsigned int size = binpage.bindata.GetDataLen(); SetItemCount((size / 16) + ((size % 16) != 0)); InsertColumn(0, _T("Offset"), wxLIST_FORMAT_RIGHT, 32); InsertColumn(1, _T("Hexadecimal"), wxLIST_FORMAT_LEFT, 400); InsertColumn(2, _T("ASCII"), wxLIST_FORMAT_LEFT); wxWindowDC dc(this); wxCoord textwidth, textheight; dc.SetFont(font); dc.GetTextExtent(_T("000000000"), &textwidth, &textheight); SetColumnWidth(0, textwidth); dc.GetTextExtent(_T("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "), &textwidth, &textheight); SetColumnWidth(1, textwidth); dc.GetTextExtent(_T("0000000000000000 "), &textwidth, &textheight); SetColumnWidth(2, textwidth); SetItemCount((size / 16) + ((size % 16) != 0)); }
// WM_SIZE handler. virtual LRESULT OnSize( UINT nSizeType, int nWidth, int nHeight ) { SetColumnWidth( 0, nWidth / 2 ); SetColumnWidth( 1, LVSCW_AUTOSIZE_USEHEADER ); SetColumnWidth( 2, LVSCW_AUTOSIZE_USEHEADER ); return ClsListView::OnSize( nSizeType, nWidth, nHeight ); }
void CGameListCtrl::AutomaticColumnWidth() { wxRect rc(GetClientRect()); if (GetColumnCount() == 1) SetColumnWidth(0, rc.GetWidth()); else if (GetColumnCount() > 4) { int resizable = rc.GetWidth() - ( GetColumnWidth(COLUMN_BANNER) + GetColumnWidth(COLUMN_COUNTRY) + GetColumnWidth(COLUMN_SIZE) + GetColumnWidth(COLUMN_EMULATION_STATE) + GetColumnWidth(COLUMN_PLATFORM)); // We hide the Notes column if the window is too small if (resizable > 400) { SetColumnWidth(COLUMN_TITLE, resizable / 2); SetColumnWidth(COLUMN_NOTES, resizable / 2); } else { SetColumnWidth(COLUMN_TITLE, resizable); SetColumnWidth(COLUMN_NOTES, 0); } } }
HOTKEY_LIST_CTRL::HOTKEY_LIST_CTRL( wxWindow *aParent, struct EDA_HOTKEY_CONFIG* aSection ) : wxListCtrl( aParent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VIRTUAL ) { m_sectionTag = aSection->m_SectionTag; m_curEditingRow = -1; InsertColumn( 0, _( "Command" ) ); InsertColumn( 1, _( "Hotkey" ) ); // Add a dummy hotkey_spec which is a header before each hotkey list EDA_HOTKEY** hotkey_descr_list; // Add a copy of hotkeys to our list for( hotkey_descr_list = aSection->m_HK_InfoList; *hotkey_descr_list; hotkey_descr_list++ ) { EDA_HOTKEY* hotkey_descr = *hotkey_descr_list; m_hotkeys.push_back( new EDA_HOTKEY( hotkey_descr ) ); } // Set item count to hotkey size, this gets it to autoload the entries SetItemCount( m_hotkeys.size() ); SetColumnWidth( 0, wxLIST_AUTOSIZE ); SetColumnWidth( 1, wxLIST_AUTOSIZE ); Bind( wxEVT_CHAR, &HOTKEY_LIST_CTRL::OnChar, this ); Bind( wxEVT_LIST_ITEM_SELECTED, &HOTKEY_LIST_CTRL::OnListItemSelected, this ); Bind( wxEVT_SIZE, &HOTKEY_LIST_CTRL::OnSize, this ); }
ThreadList::ThreadList(wxWindow *parent, const wxPoint& pos, const wxSize& size, wxButton *_ok_button, wxButton *_all_button) : wxSortedListCtrl(parent, THREADS_LIST, pos, size, wxLC_REPORT), timer(this, THREADS_LIST_TIMER), ok_button(_ok_button), all_button(_all_button) { InitSort(); wxListItem itemCol; itemCol.m_mask = wxLIST_MASK_TEXT/* | wxLIST_MASK_IMAGE*/; itemCol.m_text = _T("Thread"); itemCol.m_image = -1; InsertColumn(COL_ID, itemCol); itemCol.m_text = _T("Location"); InsertColumn(COL_LOCATION, itemCol); itemCol.m_text = _T("Thread Usage"); InsertColumn(COL_CPUUSAGE, itemCol); SetColumnWidth(COL_ID, 50); SetColumnWidth(COL_LOCATION, 200); SetColumnWidth(COL_CPUUSAGE, 120); sort_column = COL_CPUUSAGE; sort_dir = SORT_DOWN; SetSortImage(sort_column, sort_dir); process_handle = NULL; syminfo = NULL; lastTime = wxGetLocalTimeMillis(); updateThreads(NULL, NULL); timer.Start(UPDATE_DELAY); }
void HistList::UpdateColumns() { SetColumnWidth(0, wxLIST_AUTOSIZE); SetColumnWidth(1, wxLIST_AUTOSIZE); SetColumnWidth(2, wxLIST_AUTOSIZE); Layout(); }
/* ******************************************************************* * Function: void CGBLListCtrl::AutoSizeColumns(int columnNumber) * * Description : Autio sizes the columns * * Paramters : * int columnNumber - column to resize, if this is -1 all columns * are resized * * Returns : * pointer to the toolbar * ******************************************************************* */ void CGBLListCtrl::AutoSizeColumns(int columnIndex /*=-1*/) { SetRedraw(false); int minColumn; int maxColumn; if(columnIndex < 0 ) { minColumn = 0; maxColumn = GetColumnCount()-1; } else { minColumn = minColumn = columnIndex; } for (int i = minColumn; i <= maxColumn; i++) { SetColumnWidth(i,LVSCW_AUTOSIZE); int columnWidth = GetColumnWidth(i); SetColumnWidth(i,LVSCW_AUTOSIZE_USEHEADER); int headerWidth = GetColumnWidth(i); int width = max(15,max(columnWidth,headerWidth)); SetColumnWidth(i,width); } SetRedraw(true); }
void LIBRARY_LISTBOX::SetLibraryList( const wxArrayString& aList ) { int oldSelection = GetSelection(); m_libraryList = aList; SetItemCount( m_libraryList.GetCount() ); if( GetCount() == 0 || oldSelection < 0 || oldSelection >= GetCount() ) SetSelection( 0, true ); if( m_libraryList.Count() ) { RefreshItems( 0L, m_libraryList.Count()-1 ); #if defined (__WXGTK__ ) && wxMINOR_VERSION == 8 // @bug On GTK and wxWidgets 2.8.x, this will assert in debug builds because the // column parameter is -1. This was the only way to prevent GTK3 from // ellipsizing long strings down to a few characters. It still doesn't set // the scroll bars correctly (too short) but it's better than any of the // other alternatives. If someone knows how to fix this, please do. SetColumnWidth( -1, wxLIST_AUTOSIZE ); #else SetColumnWidth( 0, wxLIST_AUTOSIZE ); #endif } }
void console::TELLFuncList::addFunc(wxString name, void* arguments) { ArgList* arglist = static_cast<ArgList*>(arguments); wxListItem row; row.SetMask(wxLIST_MASK_DATA | wxLIST_MASK_TEXT); row.SetId(GetItemCount()); row.SetData(GetItemCount()); row.SetText( wxString((arglist->front()).c_str(), wxConvUTF8));arglist->pop_front(); InsertItem(row); SetColumnWidth(0, wxLIST_AUTOSIZE); // row.SetColumn(1); row.SetMask(wxLIST_MASK_TEXT); row.SetText(name.c_str()); SetItem(row); SetColumnWidth(1, wxLIST_AUTOSIZE); // wxString strlist(wxT("( ")); while (!arglist->empty()) { strlist << wxString(arglist->front().c_str(), wxConvUTF8);arglist->pop_front(); if (arglist->size()) strlist << wxT(" , "); } delete arglist; strlist << wxT(" )"); // row.SetColumn(2); row.SetMask(wxLIST_MASK_TEXT); row.SetText(strlist); SetItem(row); SetColumnWidth(2, wxLIST_AUTOSIZE); }
void console::TELLFuncList::addFunc(wxString name, void* arguments) { ArgList* arglist = static_cast<ArgList*>(arguments); wxListItem row; row.SetMask(wxLIST_MASK_DATA | wxLIST_MASK_TEXT); row.SetId(GetItemCount()); row.SetData(GetItemCount()); row.SetText((arglist->front()).c_str());arglist->pop_front(); long inum = InsertItem(row); SetColumnWidth(0, wxLIST_AUTOSIZE); // row.SetColumn(1); row.SetMask(wxLIST_MASK_TEXT); row.SetText(name.c_str()); SetItem(row); SetColumnWidth(1, wxLIST_AUTOSIZE); // std::string strlist("( "); while (!arglist->empty()) { strlist += arglist->front();arglist->pop_front(); if (arglist->size()) strlist += " , "; } strlist += " )"; // row.SetColumn(2); row.SetMask(wxLIST_MASK_TEXT); row.SetText(strlist.c_str()); SetItem(row); SetColumnWidth(2, wxLIST_AUTOSIZE); }
void CClipSpyListCtrl::Init() { SetExtendedListViewStyle ( LVS_EX_FULLROWSELECT ); InsertColumn ( 0, _T("Format"), LVCFMT_LEFT, 0, 0 ); InsertColumn ( 1, _T("Data size"), LVCFMT_LEFT, 0, 1 ); SetColumnWidth ( 0, LVSCW_AUTOSIZE_USEHEADER ); SetColumnWidth ( 1, LVSCW_AUTOSIZE_USEHEADER ); // Register this window as a clipboard viewer. This makes us get the // WM_DRAWCLIPBOARD and WM_CHANGECBCHAIN messages. The // m_bCallingSetClipboardViewer is necessary because SetClipboardViewer() // sends us a WM_DRAWCLIPBOARD but we must not process it. See // OnDrawClipboard() for more details. m_bCallingSetClipboardViewer = true; m_hwndNextClipboardViewer = SetClipboardViewer(); m_bCallingSetClipboardViewer = false; // Init our drop target object // m_pDropTarget = CDropTargetImpl<CClipSpyListCtrl>::CreateMe ( this ); // // if ( m_pDropTarget ) // m_pDropTarget->InitializeDT(); // Read the stuff on the clipboard, if there is any. ReadClipboard(); }
void HOTKEY_LIST_CTRL::recalculateColumns() { float totalLength = 0; float scale = 0; // Find max character length of first column int maxInfoMsgLength = 0; for( int i = 0; i < GetItemCount(); i++ ) { int length = GetItemText( i, 0 ).Length(); if( length > maxInfoMsgLength ) maxInfoMsgLength = length; } // Find max character length of second column int maxKeyCodeLength = 0; for( int i = 0; i < GetItemCount(); i++ ) { int length = GetItemText( i, 1 ).Length(); if( length > maxKeyCodeLength ) maxKeyCodeLength = length; } // Use the lengths of column texts to create a scale of the max list width // to set the column widths totalLength = maxInfoMsgLength + maxKeyCodeLength; scale = (float) GetClientSize().x / totalLength; SetColumnWidth( 0, int( maxInfoMsgLength*scale ) - 2 ); SetColumnWidth( 1, int( maxKeyCodeLength*scale ) ); }
//============================================================================== browsers::topedlay_list::topedlay_list(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) : wxListCtrl(parent, id, pos, size, style) { InsertColumn(0, wxT(" No ")); InsertColumn(1, wxT(" Name ")); InsertColumn(2, wxT(" S ")); SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER); SetColumnWidth(1, wxLIST_AUTOSIZE_USEHEADER); SetColumnWidth(2, wxLIST_AUTOSIZE_USEHEADER); _imageList = DEBUG_NEW wxImageList(16, 16, TRUE); #ifdef __WXMSW__ /*@TODO : Under windows - resource loading*/ // m_imageListNormal->Add( wxIcon(_T("icon1"), wxBITMAP_TYPE_ICO_RESOURCE) ); // #else //SGREM!!! Troubles with the gdb on Linux with threads! // I spent a night debugging a stupid mistake with traversing the tree // to realize finally that the gdb is doing some funny things when // stepping over next two lines. The troble comes from wxIcon constructor, // that internally is calling gdk_pixmap_create_from_xpm_d _imageList->Add( wxIcon( activelay ) ); _imageList->Add( wxIcon( lock ) ); #endif // SetBackgroundColour(wxColour("LIGHTGREY")); SetImageList(_imageList,wxIMAGE_LIST_SMALL); _llfont_normal.SetPointSize(9); _llfont_bold.SetPointSize(9); _llfont_bold.SetWeight(wxBOLD); }
////////////////////////////////////////////////////////////////////////// // CNBBindListViewCtrl ////////////////////////////////////////////////////////////////////////// void CNBBindListViewCtrl::InitColumn() { static COLUMN_INFO column_info[] = { //{ _T("Index"), 45 }, { IDS_LISTVIEW_COL_EMPTY, 20 }, { IDS_LISTVIEW_COL_NAME, 120 }, // { IDS_LISTVIEW_COL_ID, 200 }, { IDS_LISTVIEW_COL_SIZE, 100 } }; ATLASSERT( m_nColCount <= sizeof(column_info)/sizeof(column_info[0]) ); UINT i, nColCount; // Clear all the column exist nColCount = CListViewCtrl::GetHeader().GetItemCount(); for ( i=0; i < nColCount; i++ ) CListViewCtrl::DeleteColumn(0); // Add new columns for ( i=0; i < m_nColCount; i++ ) { WTL::CString strHeader; strHeader.LoadString( column_info[i].nColHeaderID ); CListViewCtrl::InsertColumn( i, strHeader, LVCFMT_LEFT, column_info[i].nWidth, -1 ); } int viewWidth = 90; SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER); SetColumnWidth(2, 50); SetColumnWidth(1, viewWidth - GetColumnWidth(0) + GetColumnWidth(2)); }
void CTDLFindTaskExpressionListCtrl::OnSize(UINT nType, int cx, int cy) { CInputListCtrl::OnSize(nType, cx, cy); // resize columns by proportion SetColumnWidth(ATTRIB, (int)(cx * COL_PROPORTIONS[ATTRIB])); SetColumnWidth(OPERATOR, (int)(cx * COL_PROPORTIONS[OPERATOR])); SetColumnWidth(VALUE, (int)(cx * COL_PROPORTIONS[VALUE])); SetColumnWidth(ANDOR, (int)(cx * COL_PROPORTIONS[ANDOR])); }
bool CListProcess::TransferDataToWindow() { wxString sTime; bool bStartTime = false; bool bStopTime = false; bool bRtn = true; bool bIsShown = IsShownOnScreen(); if(bIsShown) { Show(false); } size_t n = m_pDirList->GetCount(); long nItem; CDirEntry *pDirEntry; ClearAll(); InsertColumn(ITEM_DIR,_T("Directory"),wxLIST_FORMAT_LEFT); InsertColumn(ITEM_START,_T("Start"),wxLIST_FORMAT_LEFT); InsertColumn(ITEM_STOP,_T("Stop"),wxLIST_FORMAT_LEFT); InsertColumn(ITEM_STATUS,_T("Status"),wxLIST_FORMAT_LEFT); for(size_t i = 0; (i < n) && bRtn; i++) { pDirEntry = m_pDirList->At(i); const wxString &sInput(pDirEntry->GetInputDir()); const wxString &sStatus(pDirEntry->GetStatusString()); nItem = InsertItem((long)i,sInput); sTime = pDirEntry->FormatStartTime(); SetItem(nItem,ITEM_START,sTime); if(!sTime.IsEmpty()) { bStartTime = true; } sTime = pDirEntry->FormatStopTime(); SetItem(nItem,ITEM_STOP,sTime); if(!sTime.IsEmpty()) { bStopTime = true; } SetItem(nItem,ITEM_STATUS,sStatus); SetItemTextColour(nItem,pDirEntry->GetStatusColour()); } SetColumnWidth(ITEM_DIR,wxLIST_AUTOSIZE ); #define HEADER_SIZE 80 SetColumnWidth(ITEM_START,bStartTime ? wxLIST_AUTOSIZE : HEADER_SIZE); SetColumnWidth(ITEM_STOP,bStopTime ? wxLIST_AUTOSIZE : HEADER_SIZE); #undef HEADER_SIZE SetColumnWidth(ITEM_STATUS,wxLIST_AUTOSIZE ); if(bIsShown) { Show(true); } Refresh(); return bRtn; }
void CListProcess::UpdateStatus(int nItem) { wxString sTime; bool bStartTime = false; bool bStopTime = false; long nMin; long nMax; long nCount = (long) m_pDirList->GetCount(); if(nItem >= 0) { nMin = (long) nItem; nMax = nMin; nMax++; if(nMax > nCount) { nMax = nCount; } } else { nMin = 0; nMax = nCount; } wxListItem info; CDirEntry *pDirEntry; for(long i = nMin; i < nMax; i++) { pDirEntry = m_pDirList->At((size_t)i); const wxString &sStatus(pDirEntry->GetStatusString()); sTime = pDirEntry->FormatStartTime(); SetItem(i,ITEM_START,sTime); if(!sTime.IsEmpty()) { bStartTime = true; } sTime = pDirEntry->FormatStopTime(); SetItem(i,ITEM_STOP,sTime); if(!sTime.IsEmpty()) { bStopTime = true; } SetItem(i,ITEM_STATUS,sStatus); SetItemTextColour(i,pDirEntry->GetStatusColour()); } if(bStartTime) { SetColumnWidth(ITEM_START,wxLIST_AUTOSIZE ); } if(bStopTime) { SetColumnWidth(ITEM_STOP,wxLIST_AUTOSIZE ); } SetColumnWidth(ITEM_STATUS,wxLIST_AUTOSIZE); // Refresh(); }
void SjLogListCtrl::SizeChanged() { wxSize size = GetClientSize(); int charW = GetCharWidth(); // Returns the average character width for this window. int w1 = charW*10; int w2 = charW*10; SetColumnWidth(0, size.x-w1-w2); SetColumnWidth(1, w1); SetColumnWidth(2, w2); }
void DictionaryListCtrl::SetColumnWidths(int lastWidth) { int w; GetClientSize(&w, NULL); if (m_type == wxLOCAL) { SetColumnWidth(1, lastWidth); SetColumnWidth(0, w - GetColumnWidth(1)); } else { SetColumnWidth(0, w); } }
console::TELLFuncList::TELLFuncList(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) : wxListView(parent, id, pos, size, style) { InsertColumn(0, "type"); InsertColumn(1, "name"); InsertColumn(2, "arguments"); SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER); SetColumnWidth(1, wxLIST_AUTOSIZE_USEHEADER); SetColumnWidth(2, wxLIST_AUTOSIZE_USEHEADER); }
void PlaybackListCtrl<PlaybackType>::AddPlayback( const PlaybackType& replay ) { if ( AddItem( &replay ) ) { SetColumnWidth(0, wxLIST_AUTOSIZE); SetColumnWidth(1, wxLIST_AUTOSIZE); SetColumnWidth(2, wxLIST_AUTOSIZE); SetColumnWidth(6, wxLIST_AUTOSIZE); SetColumnWidth(7, wxLIST_AUTOSIZE); return; } wxLogWarning( _T("Replay already in list.") ); }
void CSourcesListBox::RescaleColumns() { int nWidth, nHeight; GetClientSize ( &nWidth, &nHeight ); const int main_col = 0; if ( GetColumnWidth( main_col ) != nWidth ) { #if defined(__WXMSW__) && !defined(USE_GENERICLISTCTRL) SetColumnWidth ( main_col, nWidth ); #else SetColumnWidth( main_col, nWidth - wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y) /*- GetColumnWidth( 0 )*/ - 1 ); #endif } }
void PoeditListCtrl::SizeColumns() { const int LINE_COL_SIZE = m_displayIDs ? 50 : 0; int w = GetSize().x - wxSystemSettings::GetMetric(wxSYS_VSCROLL_X) - 10 - LINE_COL_SIZE; SetColumnWidth(0, w / 2); SetColumnWidth(1, w - w / 2); if (m_displayIDs) SetColumnWidth(2, LINE_COL_SIZE); m_colWidth = (w/2) / GetCharWidth(); }
void CConnectionView::Init(HWND hwndParent) { Create(hwndParent, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | LVS_REPORT, 0); SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER); SetWindowTheme(*this, L"explorer", NULL); AddColumn(_T("Task"), 0, -1, LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM, LVCFMT_RIGHT); AddColumn(_T("Speed"), 1, -1, LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM, LVCFMT_RIGHT); AddColumn(_T("Command"), 2); AddColumn(_T("Status"), 3); SetColumnWidth(1, 80); SetColumnWidth(2, 400); SetColumnWidth(3, 250); }
// ---------------------------------------------------------------------------- // 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 StreamTable::onResize(wxSizeEvent& event) { int width, height; GetSize(&width, &height); // automatically set some widths here after resizing SetColumnWidth(0, 0.5 * width); SetColumnWidth(1, 0.5 * width); // re-layout the control, to make sure the column sizes are actually being done. Layout(); // propagate this event up the chain. If we don't do this, the control // will not be automatically resized. event.Skip(); }
//设置某列是否隐藏。如果设置成功,返回>=0。==0:原来是隐藏的, ==1:原来是显示的 int HHideListCtrl::SetColumnHide(int nCol, BOOL bHide) { int nColumnCount = m_ctlHeader.GetItemCount(); if(nCol<0 || nCol>=nColumnCount) return -1; int nHideReturn = m_ctlHeader.m_aColum[nCol].bHide; m_ctlHeader.m_aColum[nCol].bHide = bHide; if(bHide){ //是隐藏 //if(m_ctlHeader.m_aColum[nCol].bHide) return nHideReturn; m_ctlHeader.m_aColum[nCol].nItemWidth = GetColumnWidth(nCol); SetColumnWidth(nCol, 0); } else { //是显示 SetColumnWidth(nCol, m_ctlHeader.m_aColum[nCol].nItemWidth); } return nHideReturn; }
//自动设置Head的宽度 void CMyListCtrl::AutoSize() { SetRedraw(FALSE); CHeaderCtrl* pHeaderCtrl = GetHeaderCtrl(); for (int i = 0; i < pHeaderCtrl->GetItemCount(); i++) { SetColumnWidth(i, LVSCW_AUTOSIZE); int nWidth1 = GetColumnWidth(i); SetColumnWidth(i, LVSCW_AUTOSIZE_USEHEADER); int nWidth2 = GetColumnWidth(i); SetColumnWidth(i, max(nWidth1, nWidth2)); } SetRedraw(TRUE); }
void CFileBrowserListCtrl::OnDividerdblclick(NMHDR* pNMHDR, LRESULT* pResult) { HD_NOTIFY *phdn = (HD_NOTIFY *)pNMHDR; UINT col = phdn->iItem; SetColumnWidth(col, CalcMinColumnWidth(col)); *pResult = 0; }