Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Row Color

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
Stuart
Guest





PostPosted: Mon Mar 27, 2006 8:07 pm    Post subject: Row Color Reply with quote

Hi,

I've seen a few threads on setting individual rows to a different colour, and it works but I also need to preserve the current alignment settings, how would I go about this?

At the moment when I handle GetCellData and set the odd+even styles to the style I've created with a different BackColor, it also overrides the alignment I've set for each column and everything is left aligned. Is there an easy way to fix it?

Thanks,

Stuart
Back to top
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon Mar 27, 2006 9:25 pm    Post subject: Reply with quote

Try the following code in your GetCellData method:

Code:

if (highlighted)
{
    cellData.EvenStyle = new Style(cellData.EvenStyle);
    cellData.EvenStyle.Backcolor = Color.Red;
    cellData.OddStyle = cellData.EvenStyle; 
}


This assumes that you want odd and even rows to be the same when highlighted. Because the new style you create inherits from the current cell style and only overrides the backcolor it will preserve the alignment.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group