Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » How to set the color of a row
Re: How to set the color of a row [message #34322 is a reply to message #34317] Fri, 11 November 2011 20:55 Go to previous message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Hi Forlano,

I had to do something approaching and I used a gridDisplay for it:

class BgColorGridDisplay : public GridDisplay
{
	private:
		Color _bg; //(140, 140, 140);
	public:
	
	BgColorGridDisplay(const Color color)
	: _bg(color)
	{}
	 
	virtual void Paint(Draw &w, int x, int y, int cx, int cy, const Value &val, dword style,
			           Color &fg, Color &bg, Font &fnt, bool found = false, int fs = 0, int fe = 0)
   {
       if (found)
       {
	       GridDisplay::Paint(w,x,y,cx,cy,val,style,fg,bg,fnt,found,fs,fe);
       }
       else
       {
    	   GridDisplay::Paint(w,x,y,cx,cy,val,style,fg,_bg,fnt,found,fs,fe);
       }
   }
};


You can either remove the display to restore original color or enhance it to keep it form overwriting original color.

tabGrid.dataGrid.AddColumn("ColName", 110).SetDisplay( greyBgDisplay )


I use it in order to change bkgnd colour of only some columns while others are changed on cell value just like you.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: ArrayCtrl speedy writes cause crashing...why?
Next Topic: GridCtrl: master detail interactions
Goto Forum:
  


Current Time: Fri May 03 20:52:01 CEST 2024

Total time taken to generate the page: 0.01964 seconds