Allow run-time font changing.
This commit is contained in:
parent
60ee9553d4
commit
0ec7daf2c1
@ -19,8 +19,15 @@ void TrackView::setFont(HFONT font)
|
|||||||
{
|
{
|
||||||
this->font = font;
|
this->font = font;
|
||||||
|
|
||||||
rowHeight = 16;
|
assert(NULL != hwnd);
|
||||||
fontWidth = 6;
|
HDC hdc = GetDC(hwnd);
|
||||||
|
SelectObject(hdc, font);
|
||||||
|
|
||||||
|
TEXTMETRIC tm;
|
||||||
|
GetTextMetrics(hdc, &tm);
|
||||||
|
|
||||||
|
rowHeight = tm.tmHeight + tm.tmExternalLeading;
|
||||||
|
fontWidth = tm.tmAveCharWidth;
|
||||||
trackWidth = fontWidth * 16;
|
trackWidth = fontWidth * 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,11 +56,6 @@ TrackView::TrackView()
|
|||||||
|
|
||||||
this->hwnd = NULL;
|
this->hwnd = NULL;
|
||||||
|
|
||||||
// setFont((HFONT)GetStockObject(SYSTEM_FONT));
|
|
||||||
setFont((HFONT)GetStockObject(SYSTEM_FIXED_FONT));
|
|
||||||
// font = (HFONT)GetStockObject(SYSTEM_FONT);
|
|
||||||
// font = (HFONT)GetStockObject(SYSTEM_FIXED_FONT);
|
|
||||||
|
|
||||||
bgBaseBrush = GetSysColorBrush(COLOR_WINDOW);
|
bgBaseBrush = GetSysColorBrush(COLOR_WINDOW);
|
||||||
bgDarkBrush = CreateSolidBrush(darken(GetSysColor(COLOR_WINDOW), 0.9f));
|
bgDarkBrush = CreateSolidBrush(darken(GetSysColor(COLOR_WINDOW), 0.9f));
|
||||||
|
|
||||||
@ -99,6 +101,9 @@ int TrackView::getScreenX(size_t track) const
|
|||||||
|
|
||||||
LRESULT TrackView::onCreate()
|
LRESULT TrackView::onCreate()
|
||||||
{
|
{
|
||||||
|
// setFont((HFONT)GetStockObject(SYSTEM_FONT));
|
||||||
|
setFont((HFONT)GetStockObject(SYSTEM_FIXED_FONT));
|
||||||
|
|
||||||
setupScrollBars();
|
setupScrollBars();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -155,7 +155,7 @@ private:
|
|||||||
int rowHeight;
|
int rowHeight;
|
||||||
int fontWidth;
|
int fontWidth;
|
||||||
int trackWidth;
|
int trackWidth;
|
||||||
|
|
||||||
HBRUSH bgBaseBrush, bgDarkBrush;
|
HBRUSH bgBaseBrush, bgDarkBrush;
|
||||||
HBRUSH selectBaseBrush, selectDarkBrush;
|
HBRUSH selectBaseBrush, selectDarkBrush;
|
||||||
HPEN rowPen, rowSelectPen;
|
HPEN rowPen, rowSelectPen;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user