Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - How To Set Font int CXTListCtrl
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How To Set Font int CXTListCtrl

 Post Reply Post Reply
Author
Message
njyjm View Drop Down
Newbie
Newbie


Joined: 18 July 2005
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote njyjm Quote  Post ReplyReply Direct Link To This Post Topic: How To Set Font int CXTListCtrl
    Posted: 18 July 2005 at 10:29pm

   Like Vc6.0, We want to output some messages in OutputPane, it works well, but how to set the font of the ListCtrl, the following set Font segment in OnCreate(...) did not work. Please give us some help !

// CompileOutputPane.h
class CCompileOutputPane : public CWnd
{

...

public:
 CDockPaneWnd<CXTListCtrl> m_lcCompileOutput;

...

}


// CompileOutputPane.cpp
int CCompileOutputPane::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
...

  LOGFONT logFont;
  CFont   *pFont;
 
  CXTListCtrl *pListCtrl = &m_lcCompileOutput;
  pListCtrl->GetFont()->GetLogFont(&logFont);
  _tcscpy(logFont.lfFaceName, _T("Verdana"));  pFont = new CFont;
  pFont->CreateFontIndirect(&logFont);
  pListCtrl->SetFont(pFont);

...
}

void CCompileOutputPane::AppendCompileInfoLine(CString strInfo, DWORD dwItemData)
{
 CXTListCtrl *pListCtrl = &m_lcCompileOutput;
 int nCount = pListCtrl->GetItemCount();
 int nIndex = pListCtrl->InsertItem(nCount, strInfo, GetImageIndex(dwItemData));
 pListCtrl->SetItemData(nIndex, dwItemData);

 //Set Line Color

 if (dwItemData)
 {
  const COLORREF COMPILE_ERROR_TEXT_COLOR   = RGB(255, 0, 0); 
  const COLORREF COMPILE_ERROR_BACKGROUND_COLOR = pListCtrl->GetListBackColor();//RGB(198, 198, 198); 
  pListCtrl->SetRowColor(nIndex,
   COMPILE_ERROR_TEXT_COLOR,
   COMPILE_ERROR_BACKGROUND_COLOR);
 }

 pListCtrl->SendMessage(WM_VSCROLL, SB_BOTTOM);

}

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 19 July 2005 at 7:49am

add

pListCtrl->SetAutoFont(FALSE);

 

before set font.

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
jlee View Drop Down
Newbie
Newbie


Joined: 06 December 2004
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote jlee Quote  Post ReplyReply Direct Link To This Post Posted: 23 August 2005 at 11:39am

Hi Oleg,

I was trying to do a similar thing to set the font for the header using the 'SetFont' function, but it didn't seem to work. Could you please give me some help here? My code is something like this:

m_userList.GetFont()->GetLogFont(&logFont);

logFont.lfHeight = -15;

pFont = new CFont;

pFont->CreateFontIndirect(&logFont);

HWND hWndHeader = m_userList.GetDlgItem(0)->GetSafeHwnd();

m_header.SubclassWindow(hWndHeader);

m_header.SetFont(pFont);

// enable auto sizing.

m_header.EnableAutoSize(TRUE);

m_header.ResizeColumnsToFit();

m_header.SetTheme(new CXTHeaderThemeOffice2003());

...

 

Thanks alot,

JLee

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.066 seconds.