diff options
author | John Ankarström <john@ankarstrom.se> | 2022-02-18 20:25:42 +0100 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-02-18 20:25:42 +0100 |
commit | 74a6d0f006b9e0ca6167a5a021e0789aa8ac2a07 (patch) | |
tree | e9210118b3d4ddfafd2965023a90ef9249984a47 /c/main.c | |
parent | 6722589a74abb76b8aaff9ba592c5608b024dbde (diff) | |
download | EpisodeBrowser-74a6d0f006b9e0ca6167a5a021e0789aa8ac2a07.tar.gz |
Resize data list view depending on number of items.
Diffstat (limited to 'c/main.c')
-rw-r--r-- | c/main.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -88,7 +88,7 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) PostQuitMessage(0); break; case WM_SIZE: - UpdateLayout(hWnd); + UpdateLayout(); break; case WM_CREATE: HWnd = hWnd; @@ -244,22 +244,24 @@ SetupFonts() /***/ void -UpdateLayout(HWND hWnd) +UpdateLayout() { HWND hElv, hDlv; - int cxColumn, cyDlv; + int cxColumn, cyDlv, iCount; + LOGFONT lf; RECT rc; static int cxVScroll = 0; if (cxVScroll == 0) cxVScroll = GetSystemMetrics(SM_CXVSCROLL); - GetClientRect(hWnd, &rc); + GetClientRect(HWnd, &rc); /* Resize data list view. */ - hDlv = GetDlgItem(hWnd, IDC_DATALISTVIEW); - cyDlv = rc.bottom-100; + hDlv = GetDlgItem(HWnd, IDC_DATALISTVIEW); + iCount = ListView_GetItemCount(hDlv); + cyDlv = rc.bottom - (iCount ? 27+iCount*19 : 0); MoveWindow(hDlv, 0, cyDlv, rc.right, rc.bottom, TRUE); cxColumn = ListView_GetColumnWidth(hDlv, 0); @@ -268,7 +270,7 @@ UpdateLayout(HWND hWnd) /* Resize episode list view. */ - hElv = GetDlgItem(hWnd, IDC_EPISODELISTVIEW); + hElv = GetDlgItem(HWnd, IDC_EPISODELISTVIEW); MoveWindow(hElv, 0, 0, rc.right, cyDlv+1, TRUE); cxColumn = ListView_GetColumnWidth(hElv, 0); |