Fonts
-
I have created a custom control which contains two buttons. I want these buttons to display the same arraows which are displayed on a scrollbars buttons. So, I create a font using the Marlett face name and instruct the button to use this font via WM_SETFONT. I also set the buttons text to "3" 4, 5 or 6 ( which maps to the arrows ). But the button still displays the number instead of the arrow. The marlett font doesn't contain any ASCII characters, it's all pictographs! I have verified that the button is using the font via WM_GETFONT. Everything appears to be correct except that the arrows are not being displayed. Any clue as to what's gone wrong?
HFONT hFont = NULL;
hFont = (HFONT)SendMessage( m_hButtonUp, WM_GETFONT, 0, 0 );
if ( ! hFont )
hFont = (HFONT)GetStockObject( DEFAULT_GUI_FONT );
if ( ! hFont )
hFont = (HFONT)GetStockObject( ANSI_VAR_FONT );if ( hFont )
{
LOGFONT lf;
GetObject( hFont, sizeof( LOGFONT ), &lf );\_tcscpy\_s( lf.lfFaceName, LF\_FACESIZE, \_T("Marlett") ); hFont = CreateFontIndirect( &lf ); SendMessage( m\_hButtonUp, WM\_SETFONT, (WPARAM)hFont, TRUE ); SendMessage( m\_hButtonDown, WM\_SETFONT, (WPARAM)hFont, TRUE ); SendMessage( m\_hButtonUp, WM\_SETTEXT, 0, (LPARAM)\_T("3") ); SendMessage( m\_hButtonDown, WM\_SETTEXT, 0, (LPARAM)\_T("4") );
}
Waldermort
-
I have created a custom control which contains two buttons. I want these buttons to display the same arraows which are displayed on a scrollbars buttons. So, I create a font using the Marlett face name and instruct the button to use this font via WM_SETFONT. I also set the buttons text to "3" 4, 5 or 6 ( which maps to the arrows ). But the button still displays the number instead of the arrow. The marlett font doesn't contain any ASCII characters, it's all pictographs! I have verified that the button is using the font via WM_GETFONT. Everything appears to be correct except that the arrows are not being displayed. Any clue as to what's gone wrong?
HFONT hFont = NULL;
hFont = (HFONT)SendMessage( m_hButtonUp, WM_GETFONT, 0, 0 );
if ( ! hFont )
hFont = (HFONT)GetStockObject( DEFAULT_GUI_FONT );
if ( ! hFont )
hFont = (HFONT)GetStockObject( ANSI_VAR_FONT );if ( hFont )
{
LOGFONT lf;
GetObject( hFont, sizeof( LOGFONT ), &lf );\_tcscpy\_s( lf.lfFaceName, LF\_FACESIZE, \_T("Marlett") ); hFont = CreateFontIndirect( &lf ); SendMessage( m\_hButtonUp, WM\_SETFONT, (WPARAM)hFont, TRUE ); SendMessage( m\_hButtonDown, WM\_SETFONT, (WPARAM)hFont, TRUE ); SendMessage( m\_hButtonUp, WM\_SETTEXT, 0, (LPARAM)\_T("3") ); SendMessage( m\_hButtonDown, WM\_SETTEXT, 0, (LPARAM)\_T("4") );
}
Waldermort
-
I have created a custom control which contains two buttons. I want these buttons to display the same arraows which are displayed on a scrollbars buttons. So, I create a font using the Marlett face name and instruct the button to use this font via WM_SETFONT. I also set the buttons text to "3" 4, 5 or 6 ( which maps to the arrows ). But the button still displays the number instead of the arrow. The marlett font doesn't contain any ASCII characters, it's all pictographs! I have verified that the button is using the font via WM_GETFONT. Everything appears to be correct except that the arrows are not being displayed. Any clue as to what's gone wrong?
HFONT hFont = NULL;
hFont = (HFONT)SendMessage( m_hButtonUp, WM_GETFONT, 0, 0 );
if ( ! hFont )
hFont = (HFONT)GetStockObject( DEFAULT_GUI_FONT );
if ( ! hFont )
hFont = (HFONT)GetStockObject( ANSI_VAR_FONT );if ( hFont )
{
LOGFONT lf;
GetObject( hFont, sizeof( LOGFONT ), &lf );\_tcscpy\_s( lf.lfFaceName, LF\_FACESIZE, \_T("Marlett") ); hFont = CreateFontIndirect( &lf ); SendMessage( m\_hButtonUp, WM\_SETFONT, (WPARAM)hFont, TRUE ); SendMessage( m\_hButtonDown, WM\_SETFONT, (WPARAM)hFont, TRUE ); SendMessage( m\_hButtonUp, WM\_SETTEXT, 0, (LPARAM)\_T("3") ); SendMessage( m\_hButtonDown, WM\_SETTEXT, 0, (LPARAM)\_T("4") );
}
Waldermort
-
SendMessage( m_hButtonUp, WM_SETFONT, (WPARAM)hFont, TRUE ); Have you checked the return value ? I mean has the font got set ? If not, check using different fonts like arial etc.
The WM_SETFONT does not return a value according to MSDN, also I noted in my post that I did verify that the font has been set. The mistake was simple, I forgot to set the SYMBOL_CHARSET flag. Thanks anyway.
Waldermort