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 Setup ArrayCtrl colors ?
Re: How to Setup ArrayCtrl colors ? [message #18581 is a reply to message #18579] Fri, 10 October 2008 13:23 Go to previous messageGo to previous message
TeCNoYoTTa is currently offline  TeCNoYoTTa
Messages: 138
Registered: July 2008
Location: Egypt
Experienced Member

Oblivion wrote on Fri, 10 October 2008 12:41

Quote:


i want to set a color and then add a row with this color then change it and add another row with another color ......how can i do that ?



You can use Display structure and SetDisplay() method to set column colors and content:

First you should add a Display object. For example:
struct Column1Display : Display {
	virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const
	{
		w.DrawRect(r, Color(500,0,0));
	}
};

struct Column2Display : Display {
	virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const
	{
		w.DrawRect(r, Color(0,500,0));
	}
};



Then, Set the Display of the column, using ArrayCtrl::Column::SetDisplay() or Array::SetDisplay() in your constructor or wherever you instantiate your ArrayCtrl object:

MyApp::MyApp()
{
//.....
//.....

MyArray.AddColumn("Column 1").SetDisplay(Single<Column1Display>());
MyArray.AddColumn("Column 2").SetDisplay(Single<Column2Display>());

}


This will set the "column 1" and "column 2" colors. You can set other columns' displays as such. As you may have noticed, by using the Display structure you can also do other specific operations on a single column (eg, adding images, changing background, fonts, etc.). Display also has a virtual PaintBackground() method which you can set background seperately See Display structure for more information.

Regards.



thanxxxxxxxxx alot ......but i think that you are talking about columns colors ......but i want to color rows background not columns

thx again
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Spanning Columns?
Next Topic: Cells appearance and text alignment
Goto Forum:
  


Current Time: Mon Apr 29 16:26:05 CEST 2024

Total time taken to generate the page: 0.01944 seconds