![]() |
Row selction vs. column background color |
Post Reply ![]() |
Author | ||
nighthawk ![]() Senior Member ![]() ![]() Joined: 11 June 2004 Status: Offline Points: 167 |
![]() ![]() ![]() ![]() ![]() Posted: 24 March 2006 at 5:07am |
|
I have a special column on a table where each record has a different background color for the column. (Just like the colored flag status column in Outlook.) When I select a row, the row turns gray to indicate the row is selected but it overwrites the background color on the special column. Is there any way to specify the column to not turn gray when a row is selected. I still need the other columns of the row to turn gray though.
|
||
![]() |
||
sserge ![]() Moderator Group ![]() Joined: 01 December 2004 Status: Offline Points: 1297 |
![]() ![]() ![]() ![]() ![]() |
|
Try to use GetItemMetrics() callback method. See ReportSample for Automatic Formatting option and CMessageRecord::GetItemMetrics() sample method.
-- WBR, Serge |
||
![]() |
||
nighthawk ![]() Senior Member ![]() ![]() Joined: 11 June 2004 Status: Offline Points: 167 |
![]() ![]() ![]() ![]() ![]() |
|
I tried playing with the metrics but it only effected the non-selected items. When I select a row, it still turns the entire row gray.
|
||
![]() |
||
sserge ![]() Moderator Group ![]() Joined: 01 December 2004 Status: Offline Points: 1297 |
![]() ![]() ![]() ![]() ![]() |
|
Hi,
Agree with you, selection colors will override any other colors set inside GetItemMetrics(). So far, the solution would be to change control's PaintManager highlight colors on the moment of drawing this item. Inside GetItemMetrics(), insert a piece of code like following:
-- WBR, Serge |
||
![]() |
||
nighthawk ![]() Senior Member ![]() ![]() Joined: 11 June 2004 Status: Offline Points: 167 |
![]() ![]() ![]() ![]() ![]() |
|
How about in VB?
|
||
![]() |
||
sserge ![]() Moderator Group ![]() Joined: 01 December 2004 Status: Offline Points: 1297 |
![]() ![]() ![]() ![]() ![]() |
|
Almost the same. Inside _BeforeDrawRow() event handler:
-- WBR, Serge |
||
![]() |
||
nighthawk ![]() Senior Member ![]() ![]() Joined: 11 June 2004 Status: Offline Points: 167 |
![]() ![]() ![]() ![]() ![]() |
|
That is very close to what I was looking for but it still changed the highlighted color for the entire row. I did get it to work with the following modified code:
I was luckily able to use the Item.ToolTip field to identify the specific column that I did not want to be highlighted. I would like to suggest adding a property for a ReportColumn object such as "ShowHighlighted" so I could simply do something like:
in order to prevent item in that column from changing background and foreground colors when the row is selected. |
||
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |