Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - How to change color and font of CXTListView?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to change color and font of CXTListView?

 Post Reply Post Reply
Author
Message
cxmvip View Drop Down
Newbie
Newbie
Avatar

Joined: 28 June 2007
Location: China
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote cxmvip Quote  Post ReplyReply Direct Link To This Post Topic: How to change color and font of CXTListView?
    Posted: 04 July 2007 at 12:55am

I creat a MDI and want to change one row's text color and font of the CXTListView.My code is that:

  CMyView:public CXTListView
{
   void initializeListCtrl();
}
...
In the member funtion initializeListCtrl():
void CMyView::InitializeListControl()
{
 // build a date string to insert into the list control.
 CTime tm = CTime::GetCurrentTime();
 CString strTime;
  strTime.Format(_T("%d-%2d-%2d %2d:%2d:%2d"), tm.GetYear(),tm.GetMonth(), tm.GetDay(),tm.GetHour(),tm.GetMinute(),tm.GetSecond() );
 // set the image list for the list control.
 CListCtrl& rList = GetListCtrl();
 rList.SetImageList(&m_imageList, LVSIL_SMALL);
// CXTListCtrl m_listCtrl;
// &m_listCtrl=(CXTListCtrl)&rList;
    int m_i_ctrlID=rList.GetDlgCtrlID();
 // insert the first item.
 rList.InsertItem(0, NULL, 0);
 rList.SetItemText(0, 1, _T("Read"));
 rList.SetItemText(0, 2, _T("IBM"));
 rList.SetItemText(0, 3, _T("0.23"));
 rList.SetItemText(0, 4, strTime);
 rList.SetItemText(0, 5, _T("1"));
 // inset the second item.
 strTime.Format(_T("2007-10-12 12:12:12"));
 rList.InsertItem(1, NULL, 1);
 rList.SetItemText(1, 1, _T("Unread"));
 rList.SetItemText(1, 2, _T("MS"));
 rList.SetItemText(1, 3, _T("12.32"));
 rList.SetItemText(1, 4, strTime);
 rList.SetItemText(1, 5, _T("12"));
 // inset the third item.
 strTime.Format(_T("2007-8-12 13:13:13"));
 rList.InsertItem(2, NULL, 0);
 rList.SetItemText(2, 1, _T("Read"));
 rList.SetItemText(2, 2, _T("Codejock"));
 rList.SetItemText(2, 3, _T("2.67"));
 rList.SetItemText(2, 4, strTime);
 rList.SetItemText(2, 5, _T("6"));
 
 SetRowColor(1, RGB(0,0,0), RGB(255,0,0));
 
 EnableUserSortColor(true);
 // enable autosizing for columns.

 m_flatHeader.EnableAutoSize();
 // lock the first two colums from sizing operations.

 m_flatHeader.FreezeColumn(0);
 m_flatHeader.FreezeColumn(1);

}
 
 
But I cann't change the color of the second row!
By the way,how can I change the font of one row?
bird
Back to Top
cxmvip View Drop Down
Newbie
Newbie
Avatar

Joined: 28 June 2007
Location: China
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote cxmvip Quote  Post ReplyReply Direct Link To This Post Posted: 08 July 2007 at 11:53pm
I have solved to change the color .
  But it can't show correctly when it 's sorted!
How can I do?
By the way,How can I change the font of one row?
bird
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.031 seconds.