Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Font modification is not proper in ListCtrl !!
I am facing a problem related to Font support on SDI application.
Control used is List Control.
Class 'CSamp' mentioned below in the sample Source code is derived from CListView.
Source Code :
// Font Structure
// Application Object
CPSMApp* pApp = (CPSMApp*)AfxGetApp();
lfwork = pApp->m_LogFont;
// Create a Font Dialog
CFontDialog w_dlg( &lfwork );
// Flags used to indicate the User's input
w_dlg.m_cf.Flags ^= CF_EFFECTS | CF_FORCEFONTEXIST;
// Opens the Font dialog
if (w_dlg.DoModal() == IDOK)
// Load wait cursor
// Gets the Font selected in the Dialog
// If current view is Installed Software screen
CSamp *pobInsSoftView = m_pobDoc->GetSoftwareView();
// Apply font on Software View
void CSamp:FontChange( LOGFONT* rlogfont )
if( m_FontFlg == TRUE )
CFont* pOldFont = NULL;
CDC* pDC = GetDC();
memset( &tm, 0x00, sizeof(tm) );
// Delete if CFont object already exists
if( m_LBfont != NULL )
// Create new CFont object
m_LBfont = new CFont;
if( m_LBfont == NULL )
// Initializes a CFont object m_LBfont
m_LBfont->CreateFontIndirect( rlogfont );
pOldFont = pDC->SelectObject( m_LBfont );
if( pDC->GetTextMetrics(&tm) )
// Set List Item height
m_nItemHeight = tm.tmHeight + 1;
ReleaseDC( pDC );
// Changes the current font of the window
SetFont( m_LBfont, TRUE );
// Reset the charset to the original value.
rlogfont->lfCharSet = lCharSet;
While switching between Non-Japanese Support Font to Japanese Support Font and vice versa., Font application is not taking place properly.
Only when we refresh the screen, actual font application is taking place.
When i select Non-Japanese Support font (Ex. 'Times New Roman' , it displays Junk characters which is a normal behaviour.
Now when i switch from existing Non-Japanese support font to Japanese support font, even now it displays Junk characters and
only when i refresh, actual Japanese characters are displayed.
REQUIRED BEHAVIOUR :
When I set Japanese Support font, the Japanese characters should be displayed without refreshing in all possible combination
disregarding whether previously selected font is Non-Japanese support font or not.
In the above mentioned Method, actual font change takes place only when the screen is refreshed.
I need the font change to happen without refreshing or using UpdateAllViews().
OS : Windows NT 4.0 SP6a Japanese
Control used : ListCtrl
Application Type : SDI
Thanks & Regards,
Vasanth Kumar G
0 · ·