Coloring Report Control Rows !
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=3142
Printed Date: 09 November 2025 at 7:24am Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Coloring Report Control Rows !
Posted By: Maneesh
Subject: Coloring Report Control Rows !
Date Posted: 02 November 2005 at 11:55pm
On click of a botton in my dialog
I would like set the background color for a particular row.
Iam using CXTPReportControl !
Please provide me with the code to color a row !
Can I set a background color only for a Row and a Column !
Pls let me know !
Thanks
Maneesh
|
Replies:
Posted By: Warren
Date Posted: 03 November 2005 at 9:53pm
you might want code something like:
void
YourCXTPReportRecordDerivedClass::GetItemMetrics(XTP _REPORTRECORDITEM_DRAWARGS*
pDrawArgs, XTP_REPORTRECORDITEM_METRICS* pItemMetrics)
{
ASSERT( (NULL!=pDrawArgs) && (NULL!=pItemMetrics) );
if( (pDrawArgs->pRow->GetIndex() == rowNumberYouWantToColour) && (!pDrawArgs->pItem->IsPreviewItem()) ){
pItemMetrics->clrBackground = RGB(245, 245, 245);
}
}
see Codejock Samples-->
ReportSample-->MessageRecord.cpp-->CMessageRecor d::GetItemMetrics
Hope that helps...
Warren
|
Posted By: Maneesh
Date Posted: 03 November 2005 at 10:18pm
Thanks Warren !
But this function is called when the populate() fn of the rpt cnt is
called, i.e when the record is initially shown the back color is
applied !
my requirement is there are already around 10 records shown and when a user clicks a button .. the 2 row should be colored !
i hope u understand !
Maneesh
|
Posted By: sserge
Date Posted: 04 November 2005 at 2:37am
Maneesh,
There is only one way to customize colors - override GetItemMetrics or catch corresponding notification - XTP_NM_REPORT_GETITEMMETRICS.
But you can apply that for following classes:
CXTPReportRecordItem::GetItemMetrics
CXTPReportRecord::GetItemMetrics
CXTPReportRow::GetItemMetrics
I can't see what is a problem to call Populate.
May be try to call RedrawControl instead of Populate.
--
HTH,
Serge
|
|