Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Coloring Report Control Rows !
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Coloring Report Control Rows !

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


Joined: 02 May 2005
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote Maneesh Quote  Post ReplyReply Direct Link To This Post Topic: Coloring Report Control Rows !
    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
Back to Top
Warren View Drop Down
Groupie
Groupie
Avatar

Joined: 23 February 2005
Status: Offline
Points: 64
Post Options Post Options   Thanks (0) Thanks(0)   Quote Warren Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Maneesh View Drop Down
Newbie
Newbie


Joined: 02 May 2005
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote Maneesh Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post 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
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.045 seconds.