taseditor - demonstrate technique for controlling listview item height

This commit is contained in:
zeromus 2017-09-19 03:43:59 +00:00
parent f03df821ed
commit b187ceb413
2 changed files with 16 additions and 1 deletions

View File

@ -122,12 +122,22 @@ void PIANO_ROLL::init()
ANSI_CHARSET, OUT_DEVICE_PRECIS, CLIP_MASK, /*charset, precision, clipping*/ ANSI_CHARSET, OUT_DEVICE_PRECIS, CLIP_MASK, /*charset, precision, clipping*/
DEFAULT_QUALITY, DEFAULT_PITCH, /*quality, and pitch*/ DEFAULT_QUALITY, DEFAULT_PITCH, /*quality, and pitch*/
"Arial"); /*font name*/ "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)); bgBrush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
markerDragBoxBrushNormal = CreateSolidBrush(MARKED_FRAMENUM_COLOR); markerDragBoxBrushNormal = CreateSolidBrush(MARKED_FRAMENUM_COLOR);
markerDragBoxBrushBind = CreateSolidBrush(BINDMARKED_FRAMENUM_COLOR); markerDragBoxBrushBind = CreateSolidBrush(BINDMARKED_FRAMENUM_COLOR);
hwndList = GetDlgItem(taseditorWindow.hwndTASEditor, IDC_LIST1); 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 // 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); ListView_SetExtendedListViewStyleEx(hwndList, LVS_EX_DOUBLEBUFFER|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES, LVS_EX_DOUBLEBUFFER|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
// subclass the header // subclass the header
@ -392,6 +402,11 @@ void PIANO_ROLL::free()
DeleteObject(hTaseditorAboutFont); DeleteObject(hTaseditorAboutFont);
hTaseditorAboutFont = 0; hTaseditorAboutFont = 0;
} }
if (hItemMeasurementFont)
{
DeleteObject(hItemMeasurementFont);
hItemMeasurementFont = 0;
}
if (bgBrush) if (bgBrush)
{ {
DeleteObject(bgBrush); DeleteObject(bgBrush);

View File

@ -221,7 +221,7 @@ public:
HWND hwndMarkerDragBox, hwndMarkerDragBoxText; HWND hwndMarkerDragBox, hwndMarkerDragBoxText;
// GDI stuff // GDI stuff
HFONT hMainListFont, hMainListSelectFont, hMarkersFont, hMarkersEditFont, hTaseditorAboutFont; HFONT hMainListFont, hMainListSelectFont, hMarkersFont, hMarkersEditFont, hTaseditorAboutFont, hItemMeasurementFont;
HBRUSH bgBrush, markerDragBoxBrushNormal, markerDragBoxBrushBind; HBRUSH bgBrush, markerDragBoxBrushNormal, markerDragBoxBrushBind;
private: private: