Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » How to Setup ArrayCtrl colors ?
|
Re: How to Setup ArrayCtrl colors ? [message #18794 is a reply to message #18791] |
Tue, 21 October 2008 19:00 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
In fact, NoBackground makes ArrayCtrl transparent - you can then put some other widget "behind".
If you want a solid color, put StaticRect behind. But it can also be picture or anything else (Not also that StaticRect accepts "chameleon" visuals values, so you can put Image in it directly, with chameleon style hotspots..).
BTW, it also applies to EditFile, LineEdit, DocEdit, ColumnList and TreeCtrl
Mirek
[Updated on: Tue, 21 October 2008 19:01] Report message to a moderator
|
|
|
|
Re: How to Setup ArrayCtrl colors ? [message #18811 is a reply to message #16874] |
Thu, 23 October 2008 19:56 |
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...
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
|
|
|
|
|
|
Goto Forum:
Current Time: Thu Mar 28 10:51:04 CET 2024
Total time taken to generate the page: 0.01372 seconds
|