[REGEDIT] Adjust ListView column widths (#1663)

CORE-15187
This commit is contained in:
Katayama Hirofumi MZ 2019-06-17 10:04:45 +09:00 committed by GitHub
parent 78f13ae5ad
commit 6b95727282
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 10 deletions

View file

@ -49,7 +49,7 @@ typedef struct tagSORT_INFO
static INT g_iSortedColumn = 0;
#define MAX_LIST_COLUMNS (IDS_LIST_COLUMN_LAST - IDS_LIST_COLUMN_FIRST + 1)
static const int default_column_widths[MAX_LIST_COLUMNS] = { 200, 175, 400 };
static const int default_column_widths[MAX_LIST_COLUMNS] = { 35, 25, 40 }; /* in percents */
static const int column_alignment[MAX_LIST_COLUMNS] = { LVCFMT_LEFT, LVCFMT_LEFT, LVCFMT_LEFT };
LPCWSTR GetValueName(HWND hwndLV, int iStartAt)
@ -255,7 +255,7 @@ static void AddEntryToList(HWND hwndLV, LPWSTR Name, DWORD dwValType, void* ValB
}
}
static BOOL CreateListColumns(HWND hWndListView)
static BOOL CreateListColumns(HWND hWndListView, INT cxTotal)
{
WCHAR szText[50];
int index;
@ -269,7 +269,7 @@ static BOOL CreateListColumns(HWND hWndListView)
for (index = 0; index < MAX_LIST_COLUMNS; index++)
{
lvC.iSubItem = index;
lvC.cx = default_column_widths[index];
lvC.cx = (cxTotal * default_column_widths[index]) / 100;
lvC.fmt = column_alignment[index];
LoadStringW(hInst, IDS_LIST_COLUMN_FIRST + index, szText, COUNT_OF(szText));
if (ListView_InsertColumn(hWndListView, index, &lvC) == -1) return FALSE;
@ -627,7 +627,7 @@ BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result)
return FALSE;
}
HWND CreateListView(HWND hwndParent, HMENU id)
HWND CreateListView(HWND hwndParent, HMENU id, INT cx)
{
RECT rcClient;
HWND hwndLV;
@ -641,7 +641,7 @@ HWND CreateListView(HWND hwndParent, HMENU id)
if (!hwndLV) return NULL;
/* Initialize the image list, and add items to the control. */
if (!CreateListColumns(hwndLV)) goto fail;
if (!CreateListColumns(hwndLV, cx)) goto fail;
if (!InitListViewImageLists(hwndLV)) goto fail;
return hwndLV;