diff --git a/Source/API.cpp b/Source/API.cpp index 24ab39ae..f50f3eec 100644 --- a/Source/API.cpp +++ b/Source/API.cpp @@ -169,7 +169,9 @@ void OBS::AddSourceItem(LPWSTR name, bool checked, UINT index) HWND hwndSources = GetDlgItem(hwndMain, ID_SOURCES); ListView_InsertItem(hwndSources, &lvI); - ListView_SetCheckState(hwndSources, index, checked); + ListView_SetCheckState(hwndSources, index, checked); + ListView_SetColumnWidth(hwndSources, 0, LVSCW_AUTOSIZE_USEHEADER); + ListView_SetColumnWidth(hwndSources, 1, LVSCW_AUTOSIZE_USEHEADER); } bool OBS::SetScene(CTSTR lpScene) diff --git a/Source/OBS.cpp b/Source/OBS.cpp index 715f896c..5c282e4b 100644 --- a/Source/OBS.cpp +++ b/Source/OBS.cpp @@ -708,7 +708,7 @@ OBS::OBS() SetWindowLongPtr(hwndTemp, GWLP_WNDPROC, (LONG_PTR)OBS::ListboxHook); //----------------------------------------------------- - // elements listbox + // elements listview hwndTemp = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW, NULL, WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP|WS_VSCROLL|WS_CLIPSIBLINGS|LVS_REPORT|LVS_NOCOLUMNHEADER| @@ -720,11 +720,13 @@ OBS::OBS() //add single column needed for report style LVCOLUMN column; - column.mask = LVCF_TEXT | LVCF_WIDTH; + column.mask = LVCF_TEXT; column.fmt = LVCFMT_FIXED_WIDTH; - column.cx = listControlWidth - controlPadding * 3 ; + column.cx = 0; column.pszText = TEXT(""); + ListView_InsertColumn(hwndTemp, 0, &column); + ListView_InsertColumn(hwndTemp, 1, &column); listviewProc = (WNDPROC)GetWindowLongPtr(hwndTemp, GWLP_WNDPROC); SetWindowLongPtr(hwndTemp, GWLP_WNDPROC, (LONG_PTR)OBS::ListboxHook); diff --git a/Source/WindowStuff.cpp b/Source/WindowStuff.cpp index 87ce48db..1fca84e6 100644 --- a/Source/WindowStuff.cpp +++ b/Source/WindowStuff.cpp @@ -803,6 +803,11 @@ LRESULT CALLBACK OBS::ListboxHook(HWND hwnd, UINT message, WPARAM wParam, LPARAM } + if(message == WM_SIZE && id == ID_SOURCES) + { + ListView_SetColumnWidth(hwnd, 0, LVSCW_AUTOSIZE_USEHEADER); + ListView_SetColumnWidth(hwnd, 1, LVSCW_AUTOSIZE_USEHEADER); + } if(id == ID_SOURCES) { return CallWindowProc(listviewProc, hwnd, message, wParam, lParam);