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 #18811 is a reply to message #16874] Thu, 23 October 2008 19:56 Go to previous messageGo to previous message
darki699 is currently offline  darki699
Messages: 3
Registered: October 2008
Location: Hell
Junior Member
sergeynikitin wrote on Fri, 18 July 2008 19:20

How to Setup ArrayCtrl colors?
I need to setup ArrayCtrl color and current line color.



This is pretty simple if you are willing to change ArrayCtrl just a bit... Wink

Step 1: In ArrayCtrl.h add this:
void SetRowDisplay(int i, const Display& d);
void SetColDisplay(int j, const Display& d);


Step 2: In ArrayCtrl.cpp add this:
void ArrayCtrl::SetRowDisplay(int i, const Display& d)
{
	if(i >= 0 && i < GetCount())
		for (int j = 0 ; j < GetSize().cx ; j++)	
			cellinfo.At(i).At(j).Set(d);
	RefreshRow(i);
}

void ArrayCtrl::SetColDisplay(int j, const Display& d)
{
	if (j >= 0 && j < column.GetCount())
		column[j].SetDisplay(d);
}


Step 3: In your program add this:
struct MyJDisplay : Display {
	virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const
	{
		PaintBackground(w, r, q, Blend(ink, Color(0,0,0)) , Blend(paper, Color(0,0,0)), style);
		w.DrawText(r.left, r.top, q.ToString());
	}
};

For example... You can choose any color of course, but I really suggest you use Blend unless you want your Selected row to not-show.

and that's about it... Add your SetRowDisplay or SetColDisplay any way you like it. =)
If you want a nice look use this
Quote:


[your ArrayCtrl].AddColumn(column, column, columnSize).Margin(0)


when you add your column.

And an example of how I used it:
 UserMovies.SetRowDisplay(j , Single<MyJDisplay>());	


NJoy and remember that the code is not a god.
If you need to improve it, don't be afraid to add (backup everything first lol)

Darki699

[Updated on: Thu, 23 October 2008 19:57]

Report message to a moderator

 
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 10:51:45 CEST 2024

Total time taken to generate the page: 0.02874 seconds