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 

How do I set different styles for individual cells?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Infralution Support Forum Index -> Virtual Tree FAQ
View previous topic :: View next topic  
Author Message
Infralution



Joined: 28 Feb 2005
Posts: 4918

PostPosted: Thu May 04, 2006 10:52 pm    Post subject: How do I set different styles for individual cells? Reply with quote

Typically you do this by handling the GetRowData and GetCellData events and setting the OddStyle and EvenStyle for the CellData. Note that you can't just set the color properties of the default styles - this will set the colors of all cells that use this style (which by default is every cell in the tree). If you want a cell to have a different back or fore color then you need to assign it a new (or different) Style. For example in GetCellData you could do:

Code:

Style highlightStyle = new Style(cellData.OddStyle);
highlightStyle.BackColor = Color.Red;
cellData.EvenStyle = highlightStyle;
cellData.OddStyle = highlightStyle;


If you know upfront what colors/styles you need it would be better for performance to create the highlight style in your constructor and just do the assignments in GetRowData/GetCellData.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Infralution Support Forum Index -> Virtual Tree FAQ 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