From b187ceb413bc08a58e62801bcef3deb37fd96f34 Mon Sep 17 00:00:00 2001 From: zeromus Date: Tue, 19 Sep 2017 03:43:59 +0000 Subject: [PATCH] taseditor - demonstrate technique for controlling listview item height --- trunk/src/drivers/win/taseditor/piano_roll.cpp | 15 +++++++++++++++ trunk/src/drivers/win/taseditor/piano_roll.h | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/trunk/src/drivers/win/taseditor/piano_roll.cpp b/trunk/src/drivers/win/taseditor/piano_roll.cpp index a78e73ed..32d625ef 100644 --- a/trunk/src/drivers/win/taseditor/piano_roll.cpp +++ b/trunk/src/drivers/win/taseditor/piano_roll.cpp @@ -122,12 +122,22 @@ void PIANO_ROLL::init() ANSI_CHARSET, OUT_DEVICE_PRECIS, CLIP_MASK, /*charset, precision, clipping*/ DEFAULT_QUALITY, DEFAULT_PITCH, /*quality, and pitch*/ "Arial"); /*font name*/ + hItemMeasurementFont = CreateFont(10, 5, /*Height,Width*/ + 0, 0, /*escapement,orientation*/ + FW_BOLD, FALSE, FALSE, FALSE, /*weight, italic, underline, strikeout*/ + ANSI_CHARSET, OUT_DEVICE_PRECIS, CLIP_MASK, /*charset, precision, clipping*/ + DEFAULT_QUALITY, DEFAULT_PITCH, /*quality, and pitch*/ + "Courier New"); /*font name*/ bgBrush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); markerDragBoxBrushNormal = CreateSolidBrush(MARKED_FRAMENUM_COLOR); markerDragBoxBrushBind = CreateSolidBrush(BINDMARKED_FRAMENUM_COLOR); hwndList = GetDlgItem(taseditorWindow.hwndTASEditor, IDC_LIST1); + + // set a font which is overridden elsewhere (right?) and so really only used to calculate the row size + SendMessage(hwndList, WM_SETFONT, (WPARAM)hItemMeasurementFont, 0); + // prepare the main listview ListView_SetExtendedListViewStyleEx(hwndList, LVS_EX_DOUBLEBUFFER|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES, LVS_EX_DOUBLEBUFFER|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES); // subclass the header @@ -392,6 +402,11 @@ void PIANO_ROLL::free() DeleteObject(hTaseditorAboutFont); hTaseditorAboutFont = 0; } + if (hItemMeasurementFont) + { + DeleteObject(hItemMeasurementFont); + hItemMeasurementFont = 0; + } if (bgBrush) { DeleteObject(bgBrush); diff --git a/trunk/src/drivers/win/taseditor/piano_roll.h b/trunk/src/drivers/win/taseditor/piano_roll.h index 5e59ef8e..9d912a9e 100644 --- a/trunk/src/drivers/win/taseditor/piano_roll.h +++ b/trunk/src/drivers/win/taseditor/piano_roll.h @@ -221,7 +221,7 @@ public: HWND hwndMarkerDragBox, hwndMarkerDragBoxText; // GDI stuff - HFONT hMainListFont, hMainListSelectFont, hMarkersFont, hMarkersEditFont, hTaseditorAboutFont; + HFONT hMainListFont, hMainListSelectFont, hMarkersFont, hMarkersEditFont, hTaseditorAboutFont, hItemMeasurementFont; HBRUSH bgBrush, markerDragBoxBrushNormal, markerDragBoxBrushBind; private: