Print Page | Close Window

How to change color and font of CXTListView?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=7521
Printed Date: 13 November 2025 at 8:13am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to change color and font of CXTListView?
Posted By: cxmvip
Subject: How to change color and font of CXTListView?
Date 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



Replies:
Posted By: cxmvip
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net